Algorithms

Classic CS algorithms, data structures, and problem-solving patterns.

  1. Bubble Sort The simplest sorting algorithm — compare adjacent elements and bubble the largest to the top.
  2. Insertion Sort Sort by placing each element into its correct position — like organizing a hand of cards.
  3. Dutch National Flag Problem Dijkstra's three-pointer partitioning algorithm for sorting elements into three groups in O(n).
  4. Stack Sort Sorting a stack using only PUSH/POP and recursion — no loops allowed.
  5. Kadane's Algorithm Finding the maximum subarray sum in O(n) using dynamic programming.
  6. Levenshtein Distance Computing edit distance between two strings with dynamic programming — insertion, deletion, and substitution.
  7. Floyd's Cycle Detection The Tortoise and Hare algorithm for detecting cycles in linked lists, with a mathematical proof.
  8. Graph Traversal BFS and DFS implementations — the two fundamental ways to explore a graph.
  9. Branchless Programming Eliminating if-else branches with bitwise operations for better CPU pipeline performance.
  10. LeetCode Classics Solutions to Three Sum, Add Two Numbers, and Longest Substring Without Repeating Characters.