>tricks like if you are going to add up an array of floating point numbers, you need to sort them first.
...I think you'll want to use a priority queue, with the smallest numbers on top, adding the first two, and then pushing the result back onto the priority queue. Repeat until you only have one item left.