Re:The true cost of linked lists
by ChrisLomont on Monday June 06, 2022 @09:13AM
(#31640010)
You cannot talk about complexity without letting n-> infinity. Both algorithms are O(1), since n is bounded.
[ Parent
| on HN ]
Re:The true cost of linked lists
by waynesonfire on Monday June 06, 2022 @01:53PM
(#31643532)
how is n bounded in the 2nd algorithm?
If you assume that it's unbounded, then either the algorithms aren't solving the same problem or the first one is wrong, so it doesn't make sense to compare them.