Is the Doubly LinkedList Random or Sequential Access?
Sequential
What data structure is the Doubly-LinkedList nearly exactly the same as?
The Singly-LinkedList.
What’s the key difference between the Doubly-LinkedList and the Singly-LinkedList? And what benefit does this provide?
It tracks both the next and previous Nodes in the list. This allows you to traverse the list in both directions.
Define the ‘Next’ value of a Node.
That particular Nodes pointer which points to the next object in the list.
Define the ‘Previous’ value of a Node.
That particular Nodes pointer which points to the previous object in the List.
Will the head node have a previous pointer?
No, it will be null.
How do we add to the head of a Doubly-LinkedList? (3)
How do we REMOVE the head of a Doubly-LinkedList? (2)
2. Set the second Node’s previous to also point towards a null value.
How do we INSERT into the middle of a Doubly-LinkedList? (3)
How do we REMOVE from the middle of a Doubly-LinkedList? (3)
How do we ADD to the tail of a Doubly-LinkedList? (3)
How do we REMOVE from the tail of a Doubly-LinkedList? (2)
2. Set the second to last Node’s next to also point to null.
Are the BigO TimeComplexities of a Doubly-LinkedList the same as those of a Singly-LinkedList?
Yes.
What is the BigO of ACCESSING a Doubly-LinkedList?
O(n) - Linear Search
What is the BigO of SEARCHING a Doubly-LinkedList?
O(n) - Linear Search
What is the BigO of INSERTING into a Doubly-LinkedList?
O(1) for head operation.
O(1) for tail operation - If stored in memory.
O(n) for everywhere else.
What is the BigO of DELETING from a Doubly-LinkedList?
O(1) for head operation.
O(1) for tail operation - If stored in memory.
O(n) for everywhere else.
Use cases for a Doubly-LinkedList? (2)
2. Undo-Redo functionality.
When is a Doubly-LinkedList useful?
When you need stack-like functionality that requires traversing back and forth through the Stack.
What are some beneficial attributes of LinkedLists?