First, thank you for creating this course, Brian. I didn't realize how much I would enjoy the study of algorithms and recursion.
Second, I have a question regarding the Big O for Linked Lists, specifically for deletes. On line 429 of the course materials, you say that "LinkedList's adds and deletes are O(1) but the gets are O(n)". However, the delete method we implemented uses the _find method (if we are not deleting the head), which contains a loop. Would this not mean that delete is also (usually) O(n)? Building on that, would this also mean that the LinkedList is really only optimized for adds?
Looking at the Big O cheatsheet, they describe a singly linked list as having O(n) for access and search, while having O(1) for insertion and deletion, so I know I must be misunderstanding something. Could you provide a little more explanation behind this? I would greatly appreciate it 😄
First, thank you for creating this course, Brian. I didn't realize how much I would enjoy the study of algorithms and recursion.
Second, I have a question regarding the Big O for Linked Lists, specifically for deletes. On line 429 of the course materials, you say that "LinkedList's adds and deletes are O(1) but the gets are O(n)". However, the
delete
method we implemented uses the_find
method (if we are not deleting the head), which contains a loop. Would this not mean that delete is also (usually) O(n)? Building on that, would this also mean that the LinkedList is really only optimized for adds?Looking at the Big O cheatsheet, they describe a singly linked list as having O(n) for access and search, while having O(1) for insertion and deletion, so I know I must be misunderstanding something. Could you provide a little more explanation behind this? I would greatly appreciate it 😄