Lists Flashcards
1
Q
What are the 4 most important differences between singly and doubly-linked lists?
A
- Singly-linked lists only have a reference to the “next” node
- Doubly-linked lists have a reference to both the “previous” and “next” node
- Singly-linked lists have O(n) complexity when deleting nodes at the tail
- Doubly-linked lists have O(1) complexity when deleting nodes at the tail
2
Q
True or False
Both arrays and linked lists allocate memory in a sequential manner
A
False
3
Q
What is the formula to calculate the length of a sliding window?
A
right - left + 1