Applications covers sorting, searching, ranges, trees, and hashing. Advanced covers divide and conquer, heaps, and shortest paths.
Applications 12
Practice sorting, searching, range techniques, trees, and hashing.
-
Sorting at a Glance
Race seven sorting algorithms on the same array and compare their work, complexity, and use cases.
-
Bubble Sort
Repeatedly compare adjacent values and swap them to move the largest remaining value to the end.
-
Selection Sort
Repeatedly select the smallest remaining value and swap it into the next position.
-
Insertion Sort
Take values one at a time and insert them into the sorted prefix.
-
Counting Sort
Count occurrences to calculate positions without comparing values to each other.
-
Binary Search
Halve the candidates in a sorted array; explore exact search, lower and upper bounds, and parametric search.
-
Two Pointers
Move two pointers monotonically to turn some quadratic searches into linear scans.
-
Sliding Window
Maintain information about a contiguous range by updating only values entering and leaving it.
-
Prefix sums
Precompute prefix totals to answer a range-sum query with one subtraction.
-
Binary Search Tree
Insert, find, and delete values; see how tree shape changes and why a skewed tree is slow.
-
Hash Tables
Map a key directly to a bucket and explore how collisions are handled.
-
BFS and DFS
Explore the same graph breadth-first and depth-first to see how queues and stacks change the visiting order.
Advanced 4
Explore divide and conquer, heaps, shortest paths, and combined algorithms.
-
Quick Sort
Partition around a pivot, then recursively sort both sides.
-
Merge Sort
Recursively split the array, then merge sorted halves in a divide-and-conquer algorithm.
-
Heap Sort
Build a max heap, then repeatedly move the largest value to the end.
-
Dijkstra's Shortest Paths
Finalize the closest unsettled node and relax distances to its neighbors.