JS Permutation Algo
Name | JS Permutation Algo |
Author | Pi Ke |
Type | Source Code |
Size | 918.00 B |
Date | 2011-09-24 13:04:23 |
Downloads | 15 |
Tag | JavaScript,Permutation,Algorithm,Impleme |
::Description
In secondary school, we have learned permutation. Basically, for n numbers, the number of permutations for these n numbers can be calculated to n! which is called \'n factorial\'. But to display all the permutations on the screen, we need to use a recursive function. The problem is how to write this function.
Next I write a program to display the permutations for n numbers with JavaScript. First, we need to understand that from these n numbers, we can first take any one number from it, and the (n-1) numbers remaining has the similar property as the n numbers, we need to find the permutations for the (n-1) numbers, and from these (n-1) numbers, we take any one of them and there are (n-2) numbers which we need to find the permutations of them. So the whole process will stop when there is only one number left, we will can display the permutations. It is a recursive process.
(Views : 6516 Downloads : 15 )
::User say
No comment for this article.
::Comment
Comment is disabled on this page
Most updated
5 downloads 1 comments | |
7 downloads 1 comments | |
3 downloads 1 comments | |
5 downloads 1 comments |
Most downloaded
79 downloads 1 comments | |
48 downloads 1 comments | |
18 downloads 1 comments | |
15 downloads 1 comments | |
10 downloads 1 comments |
Most viewed
10 downloads 1 comments | |
15 downloads 1 comments | |
7 downloads 0 comments | |
79 downloads 1 comments |
Most commented
8 downloads 3 comments | |
48 downloads 1 comments | |
9 downloads 1 comments | |
8 downloads 1 comments | |
6 downloads 1 comments |