Java Code for permutations of a list of numbers

后端 未结 4 1401
臣服心动
臣服心动 2020-12-15 11:24

I have written a program to find all the possible permutations of a given list of items. This precisely means that my program prints all possible P(n,r) values for r=0 to n<

4条回答
  •  南方客
    南方客 (楼主)
    2020-12-15 12:08

    If you want all permutations of 15-ish or more elements, write them to disk or a db or something, since they won't fit in memory. Edit: Steinhaus–Johnson–Trotter algorithm. This is probably what you're looking for.

提交回复
热议问题