Question: next permutation

Question:next permutation

smht 44 Maple

Dear all,

Maple nicely produces all the n! permutation of a set like {a,b,c} with n elements. However, it gives all permutations at once. The resulting list can get rather large (n! elements). I am looking for a procedure which returns all the permutations one after the other. Thus, I am looking for a Maple procedure (given as source code) "next_permute(n,k)". At best, this procedure should work on any legal Maple object like Maple's "permute(n,k)" command. Thus, it should work on {a,b,c,1,[2,3]} also (and not just on the integers).  And please, it should run under Maple 9.0.

This topic is embedded into a broader theme: The number of combinatorial objects growth very fast with n. Some other combinatorial Maple functions "xyz" could get a "next_xyz" companion, too.

Thank you!

Please Wait...