News for hackers. Stuff that matters.
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.
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?
Re:The true cost of linked lists by xigoi on Monday June 06, 2022 @03:29PM (#31644903)
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.
Re:The true cost of linked lists by Sebb767 on Monday June 06, 2022 @09:44AM (#31640343)
True, but I wanted to go with a simple example to show my point.