Linked Lists Flashcards
1
Q
Add to front runtime
A
O(1) if we keep track of the head (node)
2
Q
Add to end runtime
A
O(1) if we keep track of the tail (node)
3
Q
Remove from front runtime
A
Can be O(1)
4
Q
Searching runtime
A
O(N), linear
5
Q
Insert runtime
A
O(N), linear
6
Q
Remove runtime
A
O(N), linear
7
Q
The basis of a linked list
A
Uses an array.
O(1) time to look at any index in the array.
Grows dynamically; can grow and shrink list dynamically