loading...

re: Improve Your Algorithms with this Simple Equation VIEW POST

FULL DISCUSSION
 

Hey dude, great article!

I'm just missing one thing

do i have to assume this list is always sorted?

 

This is just a formula for adding up the numbers 1 to n (the order you add numbers doesn't matter).

If you have a collection of numbers that you don't know the structure to (ie, it's not something as simple as an arithmetic sequence), there's no trick to adding them up faster that's faster than doing it one by one.

code of conduct - report abuse