EDITED: I meant COMBINATION and not PERMUTATIONS
Is there effective algorithm that will return all different permutations from the given array?
[“A”, “B”, “C”, “D”, “E”, “F”, “G”, “H”, “I”, “J”, “K”, …]
e.g.: AB,AC,AD,..,DE,..,HI,..,ABC,ABD,…,DEF,..,CDEFG,…,ABCDEFGHIJK,….
I found some algorithms, but they return ALL permutation and not different ones. By different I mean that:
-
AB & BA are the same permutations
-
DEF & FED & EFD & DFE are the same permutations,
The best I can think is sort of a binary counter: