> 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](https://grokking.realtemirov.uz/1.-introduction-to-algorithms/1.-introduction.md)
  * [What you'll learn about performance](https://grokking.realtemirov.uz/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](https://grokking.realtemirov.uz/1.-introduction-to-algorithms/2.-binary-search.md)
  * [A better way to search](https://grokking.realtemirov.uz/1.-introduction-to-algorithms/2.-binary-search.md#a-better-way-to-search)
  * [Running time](https://grokking.realtemirov.uz/1.-introduction-to-algorithms/2.-binary-search.md#running-time)
* [Big O notation](https://grokking.realtemirov.uz/1.-introduction-to-algorithms/3.-big-o-notation.md)
  * [Algorithm running times grow at different rates](https://grokking.realtemirov.uz/1.-introduction-to-algorithms/3.-big-o-notation.md#algorithm-running-times-grow-at-different-rates)
  * [Visualizing different Big O run times](https://grokking.realtemirov.uz/1.-introduction-to-algorithms/3.-big-o-notation.md#visualizing-different-big-o-run-times)
  * [Big O establishes a worst-case run time](https://grokking.realtemirov.uz/1.-introduction-to-algorithms/3.-big-o-notation.md#big-o-establishes-a-worst-case-run-time)
  * [Some common Big O run times](https://grokking.realtemirov.uz/1.-introduction-to-algorithms/3.-big-o-notation.md#some-common-big-o-run-times)
  * [The traveling salesperson](https://grokking.realtemirov.uz/1.-introduction-to-algorithms/3.-big-o-notation.md#the-traveling-salesperson)
* [Recap](https://grokking.realtemirov.uz/1.-introduction-to-algorithms/4.-recap.md)

## 2. Selection sort

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

## 3. Recursion

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

## 4. Quicksort

* [Divide & conquer](https://grokking.realtemirov.uz/4.-quicksort/1.-divide-and-conquer.md)
* [Quicksort](https://grokking.realtemirov.uz/4.-quicksort/2.-quicksort.md)
* [Big O notation revisited](https://grokking.realtemirov.uz/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](https://grokking.realtemirov.uz/4.-quicksort/4.-recap.md)

## 5. Hash tables

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

## 6. Breadth-first search

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

## 7. Dijkstra's algorithm

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

## 8. Greedy Algorithms

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

## 9. Dynamic programming

* [The knapsack problem](https://grokking.realtemirov.uz/9.-dynamic-programming/1.-the-knapsack-problem.md)
  * [The simple solution](https://grokking.realtemirov.uz/9.-dynamic-programming/1.-the-knapsack-problem.md#the-simple-solution)
  * [Dynamic programming](https://grokking.realtemirov.uz/9.-dynamic-programming/1.-the-knapsack-problem.md#dynamic-programming)
* [Knapsack problem FAQ](https://grokking.realtemirov.uz/9.-dynamic-programming/2.-knapsack-problem-faq.md)
  * [What happens if you add an item?](https://grokking.realtemirov.uz/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?](https://grokking.realtemirov.uz/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?](https://grokking.realtemirov.uz/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?](https://grokking.realtemirov.uz/9.-dynamic-programming/2.-knapsack-problem-faq.md#what-happens-if-you-add-a-smaller-item)
  * [Can you steal fractions of an item?](https://grokking.realtemirov.uz/9.-dynamic-programming/2.-knapsack-problem-faq.md#can-you-steal-fractions-of-an-item)
  * [Optimizing your travel itinerary](https://grokking.realtemirov.uz/9.-dynamic-programming/2.-knapsack-problem-faq.md#optimizing-your-travel-itinerary)
  * [Handling items that depend on each other](https://grokking.realtemirov.uz/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?](https://grokking.realtemirov.uz/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?](https://grokking.realtemirov.uz/9.-dynamic-programming/2.-knapsack-problem-faq.md#is-it-possible-that-the-best-solution-doesnt-fill-the-knapsack-completely)
* [Longest common substring](https://grokking.realtemirov.uz/9.-dynamic-programming/3.-longest-common-substring.md)
  * [Making the grid](https://grokking.realtemirov.uz/9.-dynamic-programming/3.-longest-common-substring.md#making-the-grid)
  * [Filling in the grid](https://grokking.realtemirov.uz/9.-dynamic-programming/3.-longest-common-substring.md#filling-in-the-grid)
  * [The solution](https://grokking.realtemirov.uz/9.-dynamic-programming/3.-longest-common-substring.md#the-solution)
  * [Longest common subsequence](https://grokking.realtemirov.uz/9.-dynamic-programming/3.-longest-common-substring.md#longest-common-subsequence)
  * [Longest common subsequence—solution](https://grokking.realtemirov.uz/9.-dynamic-programming/3.-longest-common-substring.md#longest-common-subsequencesolution)
* [Recap](https://grokking.realtemirov.uz/12.-answers-to-exercises/chapter-2.md)

## 10. K-nearest neighbors

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

## 11. Where to go next

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

## Answers to exercises

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