in reply to Re: Challenge: Sorting Sums Of Sorted Series
in thread Challenge: Sorting Sums Of Sorted Series
blokhead,
Your code needs some TLC and your for (0 .. $#list) should probably be for (;;) loops. I had this idea too but felt it wasn't in the spirit of what ikegami intended (though it meets my criteria just fine).
Your code needs some TLC and your for (0 .. $#list) should probably be for (;;) loops. I had this idea too but felt it wasn't in the spirit of what ikegami intended (though it meets my criteria just fine).
- Find the lowest sum paying attention to how many times it appears, then print
- Find the lowest sum that is greater than the previous pass paying attention to how many times it appears, then print
- Repeat until there are no new values found
The best solution I have (memory/time) is 4N + M but the most memory efficient while still having a reasonable run time is 2N + M.
Cheers - L~R
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: Challenge: Sorting Sums Of Sorted Series
by ikegami (Patriarch) on Feb 03, 2010 at 21:33 UTC | |
by Limbic~Region (Chancellor) on Feb 03, 2010 at 21:50 UTC | |
by ikegami (Patriarch) on Feb 03, 2010 at 22:18 UTC |
In Section
Seekers of Perl Wisdom