Hacker News new | past | comments | ask | show | jobs | submit login

Here's a real simple and practical equation: 1+2+3+4 . . . N = N(N+1)/2

This equation represents the number of edges on a complete graph with N+1 vertices or the number of possible pairings given N+1 objects. Useful when estimating O(N) for certain algorithms that involve comparing an item to every other item in a set.




It's more useful if you know how to prove it: just add the series to itself written backwards, then divide by two.

One of my math professors said that this and multiplying by things equal to one were among the tricks he used most often.


Please be careful how you use big-O notation here.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: