Re:The time complexity of the libc++ deque push_front implem...
by maple3142 on Sunday November 28, 2021 @07:55PM
(#29375057)
I wonder if it is true that everything is O(1) if there is an upper bound? Even for an algorithm with O(n^n) complexity, it is still O(1) if n is bounded, just with a extremely large constant.
[ Parent
| on HN ]
Re:The time complexity of the libc++ deque push_front implem...
by colanderman on Monday November 29, 2021 @09:47AM
(#29380447)
n has to be bounded much much smaller, and the constant overhead of the algorithm in question much much larger, for any of those approximations to be valid. The approximation works for log n only because it's not uncommon to have constant overheads which dwarf log n for all plausible n (and only works in such cases!) This is very unlikely to be true even for a linear algorithm.