+ 1
What is the best algorithm for getting all subsets of a given set of elements ?
S = {1,2,4,6} ans: {} {1,4} {2,4,6} etc…
1 Réponse
+ 1
Heap's or Steinhaus–Johnson–Trotter are the normal ones. Heap's has the most examples floating around. Memoizing will allow speedup. if you can do it in parallel as well (likely in combination with some in-memory storage table) that'll speed it up again. Note the very nature of the problem means the size extrapolates, it gets huge very quickly with longer starting lists.