Getting Started
This website contains nearly complete solutions to the bible textbook - Introduction to Algorithms Third Edition, published by Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest, and Clifford Stein.
I hope to organize solutions to help people and myself study algorithms. By using Markdown (.md) files and KaTeX math library, this page is much more readable on portable devices.
"Many a little makes a mickle."
Contributors
Thanks to the authors of CLRS Solutions, Michelle Bodnar (who writes the even-numbered problems) and Andrew Lohr (who writes the odd-numbered problems), @skanev, @CyberZHG, @yinyanghu, @Gutdub, etc.
Thanks to all contributors on GitHub, you guys make this repository a better reference!
Special thanks to @JeffreyCA, who fixed math rendering on iOS Safari in #26.
If I miss your name here, please tell me!
Motivation
I build this website since I want to help everyone learn algorithms by providing something easy to read on mobile devices.
Therefore, if any adjustment is needed or you have the same motivation to contribute to this work, please don't hesitate to give me your feedback. You can press the "pencil icon" in the upper right corner to edit the content or open an issue in this repository. Your solution will be rebased after I review it and make some form modifications to your pull request.
There're lots of issues regarding to solutions in this repository, if you have time, please take a look and try to help people on the internet :)
Thank you very much, and I hope that everyone will learn algorithms smoothly.
How I Generate the Website?
I use the static site generator MkDocs and the beautiful theme Material for MkDocs to build this website.
As for rendering math equations, I use KaTeX, which is fast and beautiful.
I also add overflow-x: auto to prevent the overflow issue on small screen devices so that you can scroll horizontally in the math display equations.
More Information
For a clear commit history, I rebase my repository regularly. Therefore, if you have forked the repository before, consider re-forking it again.
For more information, please visit my GitHub.
Updated to this new page on April 13, 2018, at 04:48 (GMT+8).
Revised on July 21, 2019.
License
Licensed under the MIT License.
Hi!
Welcome to my solutions to the exercises and problems of Introduction to Algorithms, 3rd edition, lovingly abbreviated as CLRS.
Don't trust a single word! While mistakes were not intended, they were surely made. I'm doing this for fun – I have neither the energy nor the patience to double-check everything. If you find an error, please don't contact me to fix it.
This is a journey in progress. I'm neither in a hurry, not hell-bent on getting there. I'll add new solutions over time, but am not adhering to a schedule.
Chapter 01
1.1.1 | 1.1.2 | 1.1.3 | 1.1.4 | 1.1.5 |
1.2.1 | 1.2.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 | 11.2.6 |
11.3.1 | 11.3.2 | 11.3.3 | 11.3.4 | 11.3.5 | 11.3.6 |
11.4.1 | 11.4.2 | 11.4.3 | 11.4.4 | 11.4.5 | |
11.5.1 | |||||
11.1 | 11.2 | 11.3 | 11.4 |
Chapter 12
12.1.1 | 12.1.2 | 12.1.3 | 12.1.4 | 12.1.5 | ||||
12.2.1 | 12.2.2 | 12.2.3 | 12.2.4 | 12.2.5 | 12.2.6 | 12.2.7 | 12.2.8 | 12.2.9 |
12.3.1 | 12.3.2 | 12.3.3 | 12.3.4 | 12.3.5 | 12.3.6 | |||
12.4.1 | 12.4.2 | 12.4.3 | 12.4.4 | 12.4.5 | ||||
12.1 | 12.2 | 12.3 | 12.4 |
Chapter 13
13.1.1 | 13.1.2 | 13.1.3 | 13.1.4 | 13.1.5 | 13.1.6 | 13.1.7 |
13.2.1 | 13.2.2 | 13.2.3 | 13.2.4 | 13.2.5 | ||
13.3.1 | 13.3.2 | 13.3.3 | 13.3.4 | 13.3.5 | 13.3.6 | |
13.4.1 | 13.4.2 | 13.4.3 | 13.4.4 | 13.4.5 | 13.4.6 | 13.4.7 |
13.1 | 13.2 | 13.3 | 13.4 |
Chapter 14
14.1.1 | 14.1.2 | 14.1.3 | 14.1.4 | 14.1.5 | 14.1.6 | 14.1.7 | 14.1.8 |
14.2.1 | 14.2.2 | 14.2.3 | 14.2.4 | ||||
14.3.1 | 14.3.2 | 14.3.3 | 14.3.4 | 14.3.5 | 14.3.6 | 14.3.7 | |
14.1 | 14.2 |
Chapter 15
15.1.1 | 15.1.2 | 15.1.3 | 15.1.4 | 15.1.5 | |
15.2.1 | 15.2.2 | 15.2.3 | 15.2.4 | 15.2.5 | 15.2.6 |
Chapter C
C.1.1 | C.1.2 | C.1.3 | C.1.4 | C.1.5 | C.1.6 | C.1.7 | C.1.8 | C.1.9 | C.1.10 | C.1.11 | C.1.12 | C.1.13 | C.1.14 | C.1.15 |
C.2.1 | C.2.2 | C.2.3 | C.2.4 | C.2.5 | C.2.6 | C.2.7 | C.2.8 | C.2.9 | C.2.10 | |||||
C.3.1 | C.3.2 | C.3.3 | C.3.4 | C.3.5 | C.3.6 | C.3.7 | C.3.8 | C.3.9 | C.3.10 | |||||
C.4.1 | C.4.2 | C.4.3 | C.4.4 | C.4.5 | C.4.6 | C.4.7 | C.4.8 | C.4.9 | ||||||
C.5.1 | C.5.2 | C.5.3 | C.5.4 | C.5.5 | C.5.6 | C.5.7 | ||||||||
C.1 |