3 ms·
Err... if you sum all the numbers that’s O(n) as well.
by johnfn 6y ago
Err... if you sum all the numbers that’s O(n) as well.
- abalaji 6y agoright but OP’s solution for this part of the problem is assumed to be instantaneous (ie O(0))
- smlckz 6y agoWhat is O(0)? Computation that takes 0 time? Does that make any sense?
- tantalor 6y agoNo-op :)
- randomswede 6y agoIt 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.
- shiftingleft 6y agoYou 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 https://cs.stackexchange.com/a/1661/129151
- abalaji 6y agoYeah I meant O(1), whoops
- deleted 6y ago[deleted]