DSA I
Dynamic array resize
Append to a full dynamic array so it must grow its backing buffer.
You’ll watchA new buffer is allocated, every element is copied one at a time, then the value is appended — the O(n) cost hidden inside an amortized O(1) append.
Open trace →DSA I
Tail insertion without a tail pointer
Insert at the end of a singly linked list that only tracks its head.
You’ll watchThe current pointer walks every node to reach the tail before linking the new node — a full O(n) traversal for one insertion.
Open trace →DSA I
Tail insertion with a tail pointer
Insert at the end of a list that keeps a tail pointer.
You’ll watchThe new node links straight off the tail pointer with no traversal — the same operation collapses from O(n) to O(1).
Open trace →DSA I
Hash-table collision chain
Insert several keys that hash to the same bucket with separate chaining.
You’ll watchKeys pile into one bucket’s chain while others stay empty, so a lookup walks the chain and the load factor climbs toward a resize.
Open trace →DSA I
Binary search worst-case path
Search for the final element of a sorted array of eight values.
You’ll watchThe window halves the maximum number of times before the target is found, showing why the bound is ⌊log₂ n⌋ + 1 comparisons.
Open trace →DSA I
Bubble sort on reverse-sorted input
Run Bubble Sort on a fully reversed array.
You’ll watchEvery pass performs the maximum swaps, driving comparisons and writes to the O(n²) worst case.
Open trace →DSA I
Balanced versus skewed BST search
Search the same key in a balanced tree and in a skewed tree.
You’ll watchA balanced tree reaches the key in O(log n) hops; a skewed tree degrades to a linked list and takes O(n).
Open trace →DSA II
BFS on a disconnected graph
Run breadth-first search across a graph with more than one component.
You’ll watchThe queue drains the first component, then traversal restarts from an unvisited node to cover the rest — every vertex and edge visited once.
Open trace →