Better HN
top
new
best
ask
show
jobs
Log in
Sign up
Better HN
Comment
by
aboveandbeyond
· 12y ago · 0 comments
It's actually O(1). It's (N * (N+1))/2
Comments
[–]
gregors
12y ago
that's what I said "constant time"
[–]
Terr_
12y ago
Your post is missing some required punctuation which would've made that easier to see.
[–]
randomthought
12y ago
what about (n
(n+1)/2)< 1000
n^2 ? .
[–]
thedufer
12y ago
He 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.