Skip to content
dsa/roadmap
← Roadmap
Phase 2

Linear Structures

Arrays, singly and doubly linked lists, stacks and queues: storing items in a line.

  1. 2.1Arrays & 2-D Arrays (Review)Arrays store items side by side in memory, which is why reading any index is instant. 2-D arrays are stored row by row.easy
  2. 2.2Singly Linked ListNodes on the heap, each pointing to the next. Insert at front, end or a position, delete by value, search and traverse, plus the dummy-node trick and the classic pitfalls.medium
  3. 2.3Doubly Linked ListEach node points both forward and backward. You can walk in both directions and delete a node knowing only its address, at the cost of one extra pointer per node.medium
  4. 2.4Stacks with an ArrayLast in, first out. The stack ADT (push, pop, peek, isEmpty, isFull) built on a fixed array with a top index, plus overflow and underflow.easy
  5. 2.5Stacks with a Linked ListThe same stack ADT, but the top is the head of a linked list. No fixed capacity, push and pop stay O(1), and the bracket-matching application.easy
  6. 2.6Queues with an ArrayFirst in, first out. Why a naive array queue makes dequeue O(n), how a front index makes it O(1), and the wasted-slot problem that leads to the circular queue.easy
  7. 2.7Queues with a Linked ListKeep two pointers, front and rear. Enqueue at the rear and dequeue at the front, both O(1), with no capacity limit.easy
  8. 2.8Circular QueueLet front and rear wrap around with the modulo operator, so freed slots are reused. All operations O(1) on a fixed array.medium
  9. 2.9std::stack, std::queue & std::dequeThe standard library versions you will use in real code and on LeetCode, their method names, and the classic traps (pop returns void, empty checks).easy

Keyboard shortcuts

⌘K /
Search topics, glossary, cheat sheets
space
Play / pause the visualizer
← →
Step back / forward
r
Reset the visualizer
?
Show this help