|
Title: Algo to find Permutation of say [a,b,c,d] Post by: jackdaniels on October 30, 2009, 01:46:05 AM I want to find the permutations of say 4 letters - a, b, c, d taken from 1 at a time to the number of elements (4 in this case). Need to print out the possible values - What is the best algoritm to achieve this?
e.g. result should have: a ab ba abc abd bda bdc bdca abcd b bc ... etc (all possibilities that can be made with the elements) Title: Re: Algo to find Permutation of say [a,b,c,d] Post by: Denis on November 21, 2009, 04:40:39 AM You have to generate combinations C(4, 1), ... C(4, 4) with only difference, that now order matters [a, b] != [b, a]. If you algorithm's code in Java/C++, let me know.
|