3 ms·
It's actually O(1). It's (N * (N+1))/2
by aboveandbeyond 13y ago
It's actually O(1). It's (N * (N+1))/2
- gregors 13y agothat's what I said "constant time"
- Terr_ 13y agoYour post is missing some required punctuation which would've made that easier to see.
- randomthought 13y agowhat about (n(n+1)/2)< 1000 n^2 ? .
- thedufer 13y agoHe interpreted it as "the time complexity of computing the sum of the numbers from 1 to n", which using the formula you just gave takes O(1) time.