I\'m reading the book \'Algorithms - Fourth edition\' by Sedgewick and Wayne and I must admit that some parts in the \"Analysis of Algorithms\" chapter are confusing me! Thi
As we know...
1+2+3+4...+N => N(N-1)/2
Similarly, the innermost loop works something like
1.n+2(N-1)+3(N-2)+...N.1 => N(N-1)(N-2)/6
Here is a proof for this.