0

I'm needing a specialized function to generate permutations so that I can do data comparisons. I'm not sure if this is even possible (at least on a shared server).

Details:

  • minimum of 2 (no singles)
  • none of all of the same (1 1 1 3 is ok, but 1 1 1 1 is not)
  • I really need be be able to include repeated items (1 1 1 1 4 5)

I'm currently using this function: https://stackoverflow.com/a/6092999/2702121

It is currently failing on exhausted memory (128M) for an array of 25 elements

Community
  • 1
  • 1
Jen Born
  • 741
  • 1
  • 6
  • 20
  • If it doesn't fit in memory: make the permutation, do what you want with it, discard it, and only then go for the next permutation. How do you limit repeated elements BTW? Technically, they could go on forever (an infinity of `1`'s)... – Wrikken Feb 17 '14 at 22:39
  • @Wrikken the current function does not handle repeated items (which i'd like to have a limit of 4 repeats). sorry, but i'm unclear on what you're saying in your first sentence. thanks – Jen Born Feb 18 '14 at 01:53

0 Answers0