all combinations of k elements out of n

后端 未结 5 2146
星月不相逢
星月不相逢 2020-12-01 03:23

Can somebody provide me a link or pseudocode of a function for finding all combinations of k elements out of n? possibly in STL. I don\'t need to compute n choose k, I need

5条回答
  •  情歌与酒
    2020-12-01 03:32

    http://howardhinnant.github.io/combinations.html

    Search for "for_each_combination". If you find something faster, please let me know. Unlike other algorithms I often see, this one doesn't require the element type to be LessThanComparable.

提交回复
热议问题