Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: nested combinations: algorithm advice?

by perlfan (Curate)
on Sep 22, 2004 at 13:48 UTC ( #392907=note: print w/replies, xml ) Need Help??


in reply to nested combinations: algorithm advice?

2 nested loops is bad, much less 4. I assure you that rethinking the problem with the proper data structure will make the iterative complexity much less. Since it looks like you are doing something with permuations, check out How do I permute N elements of a list?

Provide a description of your problem, and like the monks above said, we may be able to help a bit more...
  • Comment on Re: nested combinations: algorithm advice?

Replies are listed 'Best First'.
Re^2: nested combinations: algorithm advice?
by revdiablo (Prior) on Sep 22, 2004 at 17:39 UTC

    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.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://392907]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (10)
As of 2019-11-22 12:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Strict and warnings: which comes first?



    Results (111 votes). Check out past polls.

    Notices?