Forward: I hope this reply isn't taken the wrong way. I'm not trying to flame, just trying to further explain things. I tried to be as civil as possible, and if I've failed, I'm sure I'll know it by all the downvotes. 8^)
*I assure you that rethinking the problem with the proper data structure will make the iterative complexity much less.*
Rethinking the problem is why I posted a question in the first place. I needed a fresh perspective on things. If you have any ideas about what data structure would help, I'm all ears.
*Since it looks like you are doing something with permuations*
Actually, I'm working with combinations. And only the 2-element combinations, at that. For all I know, there may be another more appropriate term to describe these things. From my understanding, though, "permutations" is not it. **Update:** there's a nice description of the difference at Iterating over combinations.
*Provide a description of your problem, and like the monks above said, we may be able to help a bit more*
I apologize for this. I posted the original question in haste, and apparently forgot to mention a few important things.
| [reply] |

Comment onRe: nested combinations: algorithm advice?