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

The extra calculation doesn't change the theoretical asymptotic time complexity because O((k+1)f(n)) = O((k)f(n)) = O(f(n)). In a real computer most of the calculation time will be spent dealing with cache misses and reading from memory, especially in a linked list which is very easy to code in a cache-unfriendly manner. So it is basically free.



Thank you very much for this explanation !




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

Search: