Y
Hacker News
new
|
ask
|
show
|
jobs
by
aboveandbeyond
4468 days ago
It's actually O(1). It's (N * (N+1))/2
2 comments
gregors
4468 days ago
that's what I said "constant time"
link
Terr_
4468 days ago
Your post is missing some required punctuation which would've made that easier to see.
link
randomthought
4468 days ago
what about (n
(n+1)/2)< 1000
n^2 ? .
link
thedufer
4468 days 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.
link