I was wondering.. what is the complexity of an algorithm that starts with n elements (which I run through doing whatever). I take one element off, I do it again.. I take off
To solve the complexity for O(n+n-1+n-2....n times), we need to use Sum for mathematics formula by see this link
=> n+n+n...n times - (1+2+3...n times) => n^2- (n^2+n)/2
Complexity will be
(n^2-n)/2