English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

Algorithm to generate permutations
For every number k (0 function permutation(k, s) {
var int factorial:= 1;
for j = 2 to length(s) {
factorial := factorial* (j-1);
swap( s[j - ((k / factorial) mod j)], s[j]);
}
return s;
}
Notation
•k / j denotes integer division of k by j, i.e. the integral quotient without any remainder, and
•k mod j is the remainder following integer division of k by j.

2007-02-19 02:33:11 · 4 answers · asked by arpit k 2 in Computers & Internet Programming & Design

s is a set of which i have to generate all possible permutation

2007-02-23 01:19:09 · update #1

4 answers

---abay jhand do ka pahada hai---

2007-02-27 01:02:38 · answer #1 · answered by xxsanxx 5 · 0 0

It returns the result of the permutation of k and s. As the result may be very large, the result is stored in array instead of integer or any number-type variable.

2007-02-25 18:19:24 · answer #2 · answered by shawan_michael 2 · 0 1

Hey Arpit, this certainly looks interesting. Can you just elaborate more on the input and output, what is K and S?

2007-02-20 18:43:32 · answer #3 · answered by manoj Ransing 3 · 0 0

sorry i dont know

2007-02-19 04:13:20 · answer #4 · answered by abi n 1 · 0 0

fedest.com, questions and answers