in reply to Re^3: Stuck with manipulating an array
in thread Stuck with manipulating an array

Fair enough, but what kind of data structures will I need? This I cannot seem to figure out...

Replies are listed 'Best First'.
Re^5: Stuck with manipulating an array
by Corion (Patriarch) on Aug 28, 2017 at 13:38 UTC

    With the approach I outlined, you won't need any additional data structures beyond what you already have. You will be modifying your current list of items as you output bins though, as I already described.

    If you want to keep your unbinned array, make a copy before binning or start with the last item considered as candidate instead of the first position in the array instead.

    I highly recommend working through any algorithm on paper until you feel confident with how it works and what kind of data it accesses.