Singly Linked List
Each node points at the next. To reach the tenth you walk the first nine.
Singly Linked List: Reverse the list
Slide the pointers along: prev = 5, curr = 1.
Cost
- Access
- O(n)
- Search
- O(n)
- Insert at head
- O(1)
- Insert after node
- O(1)
- Delete after node
- O(1)
- Insert at tail
- O(n)
- Space
- O(n)
Insert at tail is O(1) with a tail pointer.
Before this
Related
Leads to
Topics that need this one first.
Taught by the same lesson
Singly Linked List covers these too, in the same run.