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

Everything can be O(1) if you put bounds on every operation.



The difference of note is when the problem statement has an implicit constraint that makes the bounds reasonable vs. when the bounds are arbitrary and artificially constrain the problems that can be solved.

Sorting integer elements that can only be represented by 64-bit ints and smaller? Radix sort for the win (*). Sorting strings which may be of any length? Well, saying you can do that in linear time is a bit disingenuous.

It is always important to recognize the properties of the problem domain when stating complexity bounds.

(*) of course, any vanilla comparison-based sort is a better first-implementation than radix sort, but we're talking about linear time algorithms here




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

Search: