Resources
- Tim Roughgarden, Algorithms Illuminated, Volumes I, II, and III. Soundlikeyourself publishing. There is also a hardback "Omnibus Edition" containing Volumes I-IV available from the same publisher.
- Even though these are three books, they are small, paperback, and relatively cheap. (As of August 2025, they about $15 each, or $10 each as an ebook; the hardcover Omnibus edition is about $60). And they are in the library!
- Additional resources, including video lectures by Tim Roughgarden, can be found here.
- Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest, Clifford Stein, Introduction to Algorithms, 3rd Edition, MIT Press.
- This book is available online for free through the Stanford library.
- CLRS has more detail than Algorithms Illuminated, and it is a great resource for additional details or extra material.
- Jon Kleinberg, Éva Tardos: Algorithm Design
- Sanjoy Dasgupta, Christos Papadimitriou, Umesh Vazirani: Algorithms
Are you having trouble getting started on a homework problem, prepping for an exam, or simply looking to get a better grasp of how to approach algorithm-focused questions?
The check our this handy Algorithms Problem-Solving Guide.
Here are some solved concept check problems from Moses Charikar and Nima Anari's CS161 section, which can help you practice basic concepts! (Note: these are solved, so we recommend printing them out and putting another piece of paper over the answers or something while you think about them). Please direct any questions to the current course staff, not to Professors Charikar and Anari.
- Asymptotic Notation
- Recurrence Relations
- Multiplication Algorithms
- Sorting Algorithms
- The Select Algorithm
- Randomized Algorithms
- Models of Sorting
- Bucketsort and Lower bounds for Sorting
- Binary Search Trees
- Hashing
- BFS/DFS
- SCCs
- Dijkstra's Algorithm
- Dynamic Programming I
- Dynamic Programming II
- Greedy Algorithms
- Minimum Spanning Trees
- Max Flow
We also recommend these nice guides from Ian Tullis:
We strongly recommend typesetting solutions to homework sets in LaTeX. LaTeX is the standard for typesetting CS/math/etc papers, and will likely come in handy outside CS161.
- LaTeX templates: Every homework set will come with a LaTeX template for you to fill in. You can look at how the problems are typeset to get an idea for how to typeset solutions.
- Guides to using LaTeX: An introduction to LaTeX can be found here. Here's another one Wikibooks. For more dynamic help, you are welcome to use LLMs for as much LaTeX help as you want.
- Online Environments: If you don't want to install LaTeX, ShareLaTeX and Overleaf are online environments which compile previews of your LaTeX documents as you type, and share your LaTeX with the rest of your HW group. Stanford students get a free OverLeaf Pro account.
- LaTeX Editors: There are many LaTeX editors which allow you to use GUI to edit your LaTeX. LyX is a free one.
- Finding symbols: Detexify lets you draw the symbol that you are looking for and get LaTeX code. A static guide is here.
We'll be using a little bit of Python in CS161. It won't be too intense, but here are some resources to help you get familiar with Python if you haven't seen it before.
- Python 3. All examples and homework files in this class will be using Python 3 , which differs from Python 2 in a few important ways. (For example, integer division works differently).
- Documentation: Python documentation is here.
- Tutorials: A good tutorial for Python can be found here
- In-line help: In the prompt in the Jupyter Notebook, if you type "help(x)" it will display a help page for x.
- Jupyter: The pre-class exercise for Lecture 2 gives some info about how to install Jupyter with Python 3. tl;dr: Here is the Jupyter documentation, which tells you how to install Jupyter notebooks. You should install Python 3.
- LLMs: Feel free to use LLMs to help you with Python as much as you like.
- Have Python resources that you like? Let us know and we'll add them here!
Welcome CGOE students!
Lectures are recorded, and there will be one recorded section each week, all available on Canvas. We'll also have remote office hours for CGOE students to take advantage of; check out the Office Hours page to see the schedule. Please post on Ed to get in touch with us if you have any questions about CGOE logistics or anything else.- Need a pick-me-up?
- LLMs are a valuable resource, and (as per our LLM Policy), we encourage you to use them wisely to help your learning. Here's a home-brewed one that works a bit differently: LargeLanguageMary.