Hacker News new | past | comments | ask | show | jobs | submit login

Err... if you sum all the numbers that’s O(n) as well.



right but OP’s solution for this part of the problem is assumed to be instantaneous (ie O(0))


You probably mean O(1).

Although: that's not true for arbitrarily sized integers either. Multiplication in O(1) implies P = NP (which further implies NP = PSPACE): https://cs.stackexchange.com/a/1661/129151


Yeah I meant O(1), whoops


What is O(0)? Computation that takes 0 time? Does that make any sense?


It is the class of functions that have the constant value 0, with a canonical exemplar f(n) = 0 (and despite having tried, I cannot find any other function, up to choice of variable name).

In terms of algorithms, I suspect that no actual algorithm fits into it and as such it is more a curiosity than actually useful.

However, O(0) is not the same as O(1), as we cannot find a constant c such that 0c dominates all possible functions that 1c can dominate.


No-op :)




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: