Linked Lists
Store items as a chain of nodes that point to each other, so inserting or removing at a known spot costs no shifting at all.
After this lesson you will be able to
- Explain how a linked list stores order with pointers instead of positions, and what that costs and buys.
- Build, traverse, insert into and delete from a singly linked list.
- Reverse a list in place by flipping pointers, and explain why the order of the pointer updates matters.
- Use the slow and fast pointer technique to find the middle and detect a cycle.
- Merge two sorted lists and use a dummy node to remove special cases.
Before you start. Arrays (to compare against), and comfort with classes: a node is just an object holding a value and a reference.