What my recursive solution does is that, For all elements that can be used at position *k*, fix that element at position *k* and then permute the rest of the elements. So if are two same elements which can be used at position *k* we must choose only one of it to avoid repeated permutations.
Array mk[256] keeps a track of the elements that have already been tried. >> Does there exist any better solution also, or this backtracking solution is >> the best? You should have a look at this: http://en.wikipedia.org/wiki/Permutation#Algorithms_to_generate_permutations On Jul 29, 12:34 am, Nitish Garg <nitishgarg1...@gmail.com> wrote: > Can you please explain what is the use of the array mk[256], how this array > solves the problem of repeated characters. > Does there exist any better solution also, or this backtracking solution is > the best? -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.