# Algorithms

## Success stories

- 14,000x Speedup - James Hiebert’s Blog; Sep 2015; HN
- Applying Textbook Data Structures for Real Life Wins - Heap

## Course Pages with Lecture notes

Duke University’s CPS130 –Introduction to Design and analysis of Algorithms is an undergraduate course. The lecture notes are good for revising basic concepts.

Jeff Erickson’s Algorithm course materials –this is a huge collection of lecture notes, homeworks and exams all in one big document (800+) pages. The tone is conversational, which helps to get a feel of the *langauge* of the subject. This is a graduate level course.

MIT’s Mathematics for Computer Science – 6.042J, has exhaustive notes on Discrete Mathematics – 2010

Stanford CS 168: The Modern Algorithmic Toolbox, Spring 2023 by Gregory Valiant; see Tim Roughgarden’s Lecture Notes

## Video Lectures

- Algorithms by Omkar Deshpande on YouTube. Detailed explanation of concepts.
- Abdul Bari - YouTube lectures on Algorithms.

## Articles

## Interviews

## Books

### Free

- Algorithms by Vazirani et. al
- Lisp, the Universe and Everything: “Programming Algorithms” Book Work in progress (as of Jan 2020). All the algorithms and data structures are explained using Lisp.
- Algorithms and Data Structures - The Basic Toolbox by Kurt Mehlhorn and Peter Sanders. [PDF]
- Algorithms for Modern Hardware - Algorithmica – Its intended audience is everyone from performance engineers and practical algorithm researchers to undergraduate computer science students who have just finished an advanced algorithms course and want to learn more practical ways to speed up a program than by going from
`O(nlogn)O(nlogn)`

to`O(nloglogn)O(nloglogn)`

.

### non-Free

- Introduction to Algorithms aka CLRS (affl.) – the standard textbook for this course in large percentage of undergraduate and graduate classes. The book weighs a ton and looks intimidating, but is quite approachable in practice.
- Grokking Algorithms: An illustrated guide for programmers and other curious people by Aditya Bhargava

## Topics

### Preliminaries

### Probability and Randomness

### Dynamic Programming

Divide and conquer algorithms partition the problem into disjoint subproblems, sovle the subproblems recurisvely and then combine their solutions to solve the original problem.

Dynamic programming algorithms apply when the subproblems overlap –ie., when subproblems share subproblems. Dynamic program solves each subproblem just once and saves the answer, thereby avoiding the recomputing the answer.

DP is typically applied to *optimisation problems*.

Four steps of DP algorithm:

- Characterise the structure of an optimal solution.
- Recursively define the value of an optimal solution
- COmpute the value of the optimal solution, typicall bottom-up.
- Construct an optimal solution from computed info.

//Characterise the structure. Define the Value. Compute the Value. Construct.

#### To Read

2013-11-01: Towards a discipline of experimental algorithms by Bernard Moret.

2013-11-01: O-notation considered harmful (use Analytic Combinatorics instead)