klocey / partitions

python based code for integer partitioning
4 stars 4 forks source link

top_down() while statement? #5

Closed dmcglinn closed 11 years ago

dmcglinn commented 11 years ago

All of the random partition algos have a similar while statement:

while q > 0: do a bunch of stuff

but with top_down() the while statement is

while q > 1:

Is this correct, and change we possibly change the code to make the algos more consistent with each other?

klocey commented 11 years ago

It's correct in that the algorithm does what it's supposed to. But, by removing several lines of 'if' statements at the bottom (i.e. if q == 1, if q > 0), and then replacing 'while q > 1:' with 'while q > 0:', things look much cleaner. Thanks, Dan.

On Fri, Jul 5, 2013 at 10:27 PM, Dan McGlinn notifications@github.comwrote:

All of the random partition algos have a similar while statement:

while q > 1: do a bunch of stuff

but with divide_and_conquer() the while statement is

while q > 0:

Is this correct, and change we possibly change the code to make the algos more consistent with each other?

— Reply to this email directly or view it on GitHubhttps://github.com/klocey/partitions/issues/5 .