in reply to Re: Spreading out the elements
in thread Spreading out the elements

[applause]

Way too cool. :) Thank you!

Did you use some existing algorithm, or did you come up with this on your own? Kudos either way, but I'm really curious.

Replies are listed 'Best First'.
Re^3: Spreading out the elements
by fenLisesi (Priest) on Jul 05, 2007 at 06:17 UTC
    There isn't much of an algorithm, really. There are na-1 slots into which the B's will go. In the general case, some slots will have
    floor( nb / (na-1) )
    B's and others will have one more. Still, it took me more than an hour from start to finish. Cheers.