So I've read this question about generation of permutations the fastest and I am probably going to use the Heap's Algorithm answer from Eric Ouellet, but what I want to do is only use the first N numbers of each permutation. Kind of like combinations but order matters. So Permutate 25 Take 10 is what I would say. If I was doing this for Permutate 3 Take 2, I would end up with
{1,2},{2,1},{3,2},{2,3},{1,3},{3,1}
I know if your Permutate length - choose > 1, you will end up with duplicates and I guess I will just ignore them while iterating through the results.
But to do this for my Permutate 25 Take 10, do you have to do the entire permutation of 25, then post process each permutation to return the first 10 items, or can Heap's (or something) be written in a manner to have the same cost as permutating 10 items? Any sample code would be great, preferably in C#, but I'm sure I could translate it from whatever.