Hacker News new | ask | show | jobs
by oskarkv 4703 days ago
Of course O(n) is not equal to O(n^2). O(n) is a set, and O(n^2) is a different set.
1 comments

Big O is a upper bound , what I meant was that if a piece of code has O(n) then it also has O(n^2). With emphasis on the upper bound f(x) = O(g(x)) if f(x) <= cg(x).

so my point is if f(N) = O(N) then f(N) is also equal to O(N^2) as f(N) <= CN^2 .