> For the complete documentation index, see [llms.txt](https://grokking.realtemirov.uz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://grokking.realtemirov.uz/readme.md).

# Content

## 1. Introduction to Algorithms

* [Introduction](/1.-introduction-to-algorithms/1.-introduction.md)
  * [What you'll learn about performance](/1.-introduction-to-algorithms/1.-introduction.md#what-youll-learn-about-performance)
  * [What you'll learn about solving problems](https://github.com/realtemirov/grokking-algorithms/blob/main/1.%20Introduction%20to%20Algorithms/01%20Introduction.md#what-youll-learn-about-solving-problems)
* [Binary search](/1.-introduction-to-algorithms/2.-binary-search.md)
  * [A better way to search](/1.-introduction-to-algorithms/2.-binary-search.md#a-better-way-to-search)
  * [Running time](/1.-introduction-to-algorithms/2.-binary-search.md#running-time)
* [Big O notation](/1.-introduction-to-algorithms/3.-big-o-notation.md)
  * [Algorithm running times grow at different rates](/1.-introduction-to-algorithms/3.-big-o-notation.md#algorithm-running-times-grow-at-different-rates)
  * [Visualizing different Big O run times](/1.-introduction-to-algorithms/3.-big-o-notation.md#visualizing-different-big-o-run-times)
  * [Big O establishes a worst-case run time](/1.-introduction-to-algorithms/3.-big-o-notation.md#big-o-establishes-a-worst-case-run-time)
  * [Some common Big O run times](/1.-introduction-to-algorithms/3.-big-o-notation.md#some-common-big-o-run-times)
  * [The traveling salesperson](/1.-introduction-to-algorithms/3.-big-o-notation.md#the-traveling-salesperson)
* [Recap](/1.-introduction-to-algorithms/4.-recap.md)

## 2. Selection sort

* [How memory works](/2.-selection-sort/1.-how-memory-works.md)
* [Arrays and linked lists](/2.-selection-sort/2.-arrays-and-linked-lists.md)
  * [Linked lists](/2.-selection-sort/2.-arrays-and-linked-lists.md#linked-lists)
  * [Arrays](/2.-selection-sort/2.-arrays-and-linked-lists.md#arrays)
  * [Terminology](/2.-selection-sort/2.-arrays-and-linked-lists.md#terminology)
  * [Inserting into the middle of a list](/2.-selection-sort/2.-arrays-and-linked-lists.md#inserting-into-the-middle-of-a-list)
  * [Deletions](/2.-selection-sort/2.-arrays-and-linked-lists.md#deletions)
* [Selection sort](/2.-selection-sort/3.-selection-sort.md)
* [Recap](/2.-selection-sort/4.-recap.md)

## 3. Recursion

* [Recursion](/3.-recursion/1.-recursion.md)
* [Base case and recursive case](/3.-recursion/2.-base-case-and-recursive-case.md)
* [The stack](/3.-recursion/3.-the-stack.md)
  * [The call stack](/3.-recursion/3.-the-stack.md#the-call-stack)
  * [The call stack with recursion](/3.-recursion/3.-the-stack.md#the-call-stack-with-recursion)
* [Recap](/3.-recursion/4.-recap.md)

## 4. Quicksort

* [Divide & conquer](/4.-quicksort/1.-divide-and-conquer.md)
* [Quicksort](/4.-quicksort/2.-quicksort.md)
* [Big O notation revisited](/4.-quicksort/3.-big-o-notation-revisited.md)
  * [Merge sort vs. quicksort](https://grokking.realtemirov.uz/pages/FhcKzKddpzZsNk9hcbS7#merge-sort-vs.-quicksort)
  * [Average case vs. worst case](https://grokking.realtemirov.uz/pages/FhcKzKddpzZsNk9hcbS7#average-case-vs.-worst-case)
* [Recap](/4.-quicksort/4.-recap.md)

## 5. Hash tables

* [Hash functions](/5.-hash-tables/1.-hash-functions.md)
* [Use cases](/5.-hash-tables/2.-use-cases.md)
  * [Using hash tables for lookups](/5.-hash-tables/2.-use-cases.md#using-hash-tables-for-lookups)
  * [Preventing duplicate entries](/5.-hash-tables/2.-use-cases.md#preventing-duplicate-entries)
  * [Using hash tables as a cache](/5.-hash-tables/2.-use-cases.md#using-hash-tables-as-a-cache)
  * [Recap](/5.-hash-tables/2.-use-cases.md#recap)
* [Collisions](/5.-hash-tables/3.-collisions.md)
* [Performance](/5.-hash-tables/4.-performance.md)
  * [Load factor](/5.-hash-tables/4.-performance.md#load-factor)
  * [A good hash function](/5.-hash-tables/4.-performance.md#a-good-hash-function)
* [Recap](/5.-hash-tables/5.-recap.md)

## 6. Breadth-first search

* [Introduction to graph](/6.-breadth-first-search/1.-introduction-to-graph.md)
* [What is a graph](/6.-breadth-first-search/2.-what-is-a-graph.md)
* [Breadth-first search](/6.-breadth-first-search/3.-breadth-first-search.md)
  * [Finding the shortes path](/6.-breadth-first-search/3.-breadth-first-search.md#finding-the-shortes-path)
  * [Queues](/6.-breadth-first-search/3.-breadth-first-search.md#queues)
* [Implementing the graph](/6.-breadth-first-search/4.-implementing-the-graph.md)
* [Implementing the algorithm](/6.-breadth-first-search/5.-implementing-the-algorithm.md)
  * [Running time](/6.-breadth-first-search/5.-implementing-the-algorithm.md#running-time)
* [Recap](/6.-breadth-first-search/6.-recap.md)

## 7. Dijkstra's algorithm

* [Working with Dijkstra's algorithm](/7.-dijkstras-algorithm/1.-working-with-dijkstras-algorithm.md)
* [Terminology](/7.-dijkstras-algorithm/2.-terminology.md)
* [Trading for a piano](/7.-dijkstras-algorithm/3.-trading-for-a-piano.md)
* [Negative-weight edges](/7.-dijkstras-algorithm/4.-negative-weight-edges.md)
* [Implementation](/7.-dijkstras-algorithm/5.-implementation.md)
* [Recap](/7.-dijkstras-algorithm/6.-recap.md)

## 8. Greedy Algorithms

* [The classroom scheduling problem](/8.-greedy-algorithms/1.-the-classroom-scheduling-problem.md)
* [The knapsack problem](/8.-greedy-algorithms/2.-the-knapsack-problem.md)
* [The set-covering problem](/8.-greedy-algorithms/3.-the-set-covering-problem.md)
  * [Approximation algorithms](/8.-greedy-algorithms/3.-the-set-covering-problem.md#approximation-algorithms)
* [NP-complete problems](/8.-greedy-algorithms/4.-np-complete-problems.md)
* [Traveling salesperson, step by step](/8.-greedy-algorithms/5.-traveling-salesperson-step-by-step.md)
  * [How do you tell if a problem is NP-complete?](/8.-greedy-algorithms/5.-traveling-salesperson-step-by-step.md#how-do-you-tell-if-a-problem-is-np-complete)
* [Recap](/8.-greedy-algorithms/6.-recap.md)

## 9. Dynamic programming

* [The knapsack problem](/9.-dynamic-programming/1.-the-knapsack-problem.md)
  * [The simple solution](/9.-dynamic-programming/1.-the-knapsack-problem.md#the-simple-solution)
  * [Dynamic programming](/9.-dynamic-programming/1.-the-knapsack-problem.md#dynamic-programming)
* [Knapsack problem FAQ](/9.-dynamic-programming/2.-knapsack-problem-faq.md)
  * [What happens if you add an item?](/9.-dynamic-programming/2.-knapsack-problem-faq.md#what-happens-if-you-add-an-item)
  * [What happens if you change the order of the rows?](/9.-dynamic-programming/2.-knapsack-problem-faq.md#what-happens-if-you-change-the-order-of-the-rows)
  * [Can you fill in the grid column-wise instead of row-wise?](/9.-dynamic-programming/2.-knapsack-problem-faq.md#can-you-fill-in-the-grid-column-wise-instead-of-row-wise)
  * [What happens if you add a smaller item?](/9.-dynamic-programming/2.-knapsack-problem-faq.md#what-happens-if-you-add-a-smaller-item)
  * [Can you steal fractions of an item?](/9.-dynamic-programming/2.-knapsack-problem-faq.md#can-you-steal-fractions-of-an-item)
  * [Optimizing your travel itinerary](/9.-dynamic-programming/2.-knapsack-problem-faq.md#optimizing-your-travel-itinerary)
  * [Handling items that depend on each other](/9.-dynamic-programming/2.-knapsack-problem-faq.md#handling-items-that-depend-on-each-other)
  * [Is it possible that the solution will require more than two sub-knapsacks?](/9.-dynamic-programming/2.-knapsack-problem-faq.md#is-it-possible-that-the-solution-will-require-more-than-two-sub-knapsacks)
  * [Is it possible that the best solution doesn't fill the knapsack completely?](/9.-dynamic-programming/2.-knapsack-problem-faq.md#is-it-possible-that-the-best-solution-doesnt-fill-the-knapsack-completely)
* [Longest common substring](/9.-dynamic-programming/3.-longest-common-substring.md)
  * [Making the grid](/9.-dynamic-programming/3.-longest-common-substring.md#making-the-grid)
  * [Filling in the grid](/9.-dynamic-programming/3.-longest-common-substring.md#filling-in-the-grid)
  * [The solution](/9.-dynamic-programming/3.-longest-common-substring.md#the-solution)
  * [Longest common subsequence](/9.-dynamic-programming/3.-longest-common-substring.md#longest-common-subsequence)
  * [Longest common subsequence—solution](/9.-dynamic-programming/3.-longest-common-substring.md#longest-common-subsequencesolution)
* [Recap](/12.-answers-to-exercises/chapter-2.md)

## 10. K-nearest neighbors

* [Classifying oranges vs. grapefruit](/10.-k-nearest-neighbors/1.-classifying-oranges-vs.-grapefruit.md)
* [Building a recommendations system](/10.-k-nearest-neighbors/2.-building-a-recommendations-system.md)
  * [Feature extraction](/10.-k-nearest-neighbors/2.-building-a-recommendations-system.md#feature-extraction)
  * [Regression](/10.-k-nearest-neighbors/2.-building-a-recommendations-system.md#regression)
  * [Picking good features](/10.-k-nearest-neighbors/2.-building-a-recommendations-system.md#picking-good-features)
* [Introduction to machine learning](/10.-k-nearest-neighbors/3.-introduction-to-machine-learning.md)
  * [OCR](/10.-k-nearest-neighbors/3.-introduction-to-machine-learning.md#ocr)
  * [Building a spam filter](/10.-k-nearest-neighbors/3.-introduction-to-machine-learning.md#building-a-spam-filter)
  * [Predicting the stock market](/10.-k-nearest-neighbors/3.-introduction-to-machine-learning.md#predicting-the-stock-market)
* [Recap](/10.-k-nearest-neighbors/4.-recap.md)

## 11. Where to go next

* [Trees](/11.-where-to-go-next/1.-trees.md)
* [Inverted indexes](/11.-where-to-go-next/2.-inverted-indexes.md)
* [The Fourier transform](/11.-where-to-go-next/3.-the-fourier-transform.md)
* [Parallel algorithms](/11.-where-to-go-next/4.-parallel-algorithms.md)
* [MapReduce](/11.-where-to-go-next/5.-mapreduce.md)
  * [Why are distributed algorithms useful?](/11.-where-to-go-next/5.-mapreduce.md#why-are-distributed-algorithms-useful)
  * [The map function](/11.-where-to-go-next/5.-mapreduce.md#the-map-function)
  * [The reduce function](/11.-where-to-go-next/5.-mapreduce.md#the-reduce-function)
* [Bloom filters and HyperLogLog](/11.-where-to-go-next/6.-bloom-filters-and-hyperloglog.md)
  * [Bloom filters](/11.-where-to-go-next/6.-bloom-filters-and-hyperloglog.md#bloom-filters)
  * [HyperLogLog](/11.-where-to-go-next/6.-bloom-filters-and-hyperloglog.md#hyperloglog)
* [The SHA algorithms](/11.-where-to-go-next/7.-the-sha-algorithms.md)
  * [Comparing files](/11.-where-to-go-next/7.-the-sha-algorithms.md#comparing-files)
  * [Checking passwords](/11.-where-to-go-next/7.-the-sha-algorithms.md#checking-passwords)
* [Locality-sensitive hashing](/11.-where-to-go-next/8.-locality-sensitive-hashing.md)
* [Diffie-Hellman key exchange](/11.-where-to-go-next/9.-diffie-hellman-key-exchange.md)
* [Linear programming](/11.-where-to-go-next/10.-linear-programming.md)
* [Epilogue](/11.-where-to-go-next/11.-epilogue.md)

## Answers to exercises

* [Chapter 1](/12.-answers-to-exercises/chapter-1.md)
* [Chapter 2](/12.-answers-to-exercises/chapter-5.md)
* [Chapter 3](/12.-answers-to-exercises/chapter-6.md)
* [Chapter 4](/12.-answers-to-exercises/chapter-7.md)
* [Chapter 5](/12.-answers-to-exercises/chapter-8.md)
* [Chapter 6](/12.-answers-to-exercises/chapter-9.md)
* [Chapter 7](/12.-answers-to-exercises/chapter-10.md)
* [Chapter 8](broken://pages/Iua3vQKunQiNX0j0I5NZ)
* [Chapter 9](broken://pages/dovO8dJL3h1BwkiqcRqm)
* [Chapter 10](broken://pages/AREo78NqnovRJahp0AGe)
