├── LICENSE └── README.md /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Sheng-Qi Shen 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Algorithms Specialization 2 | 3 | Course can be found in [Coursera](https://www.coursera.org/specializations/algorithms) 4 | 5 | Quiz answers and notes can be found in my blog [SSQ](https://ssq.github.io/2017/07/17/Coursera%20S%20Algorithms%20Specialization%20Notebook/) 6 | 7 | ## 1. Divide and Conquer, Sorting and Searching, and Randomized Algorithms 8 | 9 | Course can be found in [Coursera](https://www.coursera.org/learn/algorithms-divide-conquer) 10 | 11 | Slides and more details about this course can be found in my Github [SSQ](https://github.com/SSQ/Coursera-Stanford-Divide-and-Conquer-Sorting-and-Searching-and-Randomized-Algorithms) 12 | 13 | - Week 1: 14 | - 1: Divide and Conquer: 15 | - [Integer Multiplication](https://github.com/SSQ/Coursera-Stanford-Divide-and-Conquer-Sorting-and-Searching-and-Randomized-Algorithms/blob/master/Lecture%20Slides/1.2-algo1-intro2_typed.pdf); 16 | - [Karatsuba Multiplication](https://github.com/SSQ/Coursera-Stanford-Divide-and-Conquer-Sorting-and-Searching-and-Randomized-Algorithms/blob/master/Lecture%20Slides/1.3-algo1-intro3_typed.pdf); 17 | - [x] [Implementation](https://github.com/SSQ/Coursera-Stanford-Divide-and-Conquer-Sorting-and-Searching-and-Randomized-Algorithms/tree/master/Programming%20Assignment%201) by Python; 18 | - [Merge Sort](https://github.com/SSQ/Coursera-Stanford-Divide-and-Conquer-Sorting-and-Searching-and-Randomized-Algorithms/blob/master/Lecture%20Slides/1.6-slides_algo-merge2_typed.pdf). 19 | - 2: Asymptotic Analysis: 20 | - [Big-oh notation](https://github.com/SSQ/Coursera-Stanford-Divide-and-Conquer-Sorting-and-Searching-and-Randomized-Algorithms/blob/master/Lecture%20Slides/2.2-slides_algo-asymptotic1_typed.pdf); [Omega and Theta notation](https://github.com/SSQ/Coursera-Stanford-Divide-and-Conquer-Sorting-and-Searching-and-Randomized-Algorithms/blob/master/Lecture%20Slides/2.4-slides_algo-asymptotic3_typed.pdf); 21 | 22 | - Week 2: 23 | - 3: Divide and Conquer: 24 | - [Counting Inversions](https://github.com/SSQ/Coursera-Stanford-Divide-and-Conquer-Sorting-and-Searching-and-Randomized-Algorithms/blob/master/Lecture%20Slides/3.2-slides_algo-inversions2_typed.pdf) 25 | - [x] [Implementation](https://github.com/SSQ/Coursera-Stanford-Divide-and-Conquer-Sorting-and-Searching-and-Randomized-Algorithms/tree/master/Programming%20Assignment%202) by python; 26 | - [Matrix Multiplication](https://github.com/SSQ/Coursera-Stanford-Divide-and-Conquer-Sorting-and-Searching-and-Randomized-Algorithms/blob/master/Lecture%20Slides/3.3-slides_algo-strassen_typed.pdf) Strassen’s Algorithm 27 | - [Closest Pair](https://github.com/SSQ/Coursera-Stanford-Divide-and-Conquer-Sorting-and-Searching-and-Randomized-Algorithms/blob/master/Lecture%20Slides/3.4-slides_algo-closest1_typed.pdf) Optional 28 | - 4: The Master Method: 29 | - [Motivation](https://github.com/SSQ/Coursera-Stanford-Divide-and-Conquer-Sorting-and-Searching-and-Randomized-Algorithms/blob/master/Lecture%20Slides/4.1-slides_algo-master1_typed.pdf); [Example](https://github.com/SSQ/Coursera-Stanford-Divide-and-Conquer-Sorting-and-Searching-and-Randomized-Algorithms/blob/master/Lecture%20Slides/4.3-slides_algo-master3_typed.pdf); [Proof I](https://github.com/SSQ/Coursera-Stanford-Divide-and-Conquer-Sorting-and-Searching-and-Randomized-Algorithms/blob/master/Lecture%20Slides/4.4-slides_algo-master4_typed.pdf), [Proof II](https://github.com/SSQ/Coursera-Stanford-Divide-and-Conquer-Sorting-and-Searching-and-Randomized-Algorithms/blob/master/Lecture%20Slides/4.6-slides_algo-master6_typed.pdf) 30 | 31 | - Week 3: 32 | - 5: Randomized Algorithm - QuickSort: 33 | - [Overview](https://github.com/SSQ/Coursera-Stanford-Divide-and-Conquer-Sorting-and-Searching-and-Randomized-Algorithms/blob/master/Lecture%20Slides/5.1-slides_algo-qsort-intro_typed.pdf); [The Partition Subroutine](https://github.com/SSQ/Coursera-Stanford-Divide-and-Conquer-Sorting-and-Searching-and-Randomized-Algorithms/blob/master/Lecture%20Slides/5.2-slides_algo-qsort-partition_typed.pdf); [Proof](https://github.com/SSQ/Coursera-Stanford-Divide-and-Conquer-Sorting-and-Searching-and-Randomized-Algorithms/blob/master/Lecture%20Slides/5.3-slides_algo-qsort-correctness_typed.pdf); [Choosing a Good Pivot](https://github.com/SSQ/Coursera-Stanford-Divide-and-Conquer-Sorting-and-Searching-and-Randomized-Algorithms/blob/master/Lecture%20Slides/5.4-slides_algo-qsort-pivot_typed.pdf) 34 | - [x] [Implementation of QuickSort](https://github.com/SSQ/Coursera-Stanford-Divide-and-Conquer-Sorting-and-Searching-and-Randomized-Algorithms/tree/master/Programming%20Assignment%203) with 3 pivots by python 35 | - 6: QuickSort Analysis: 36 | - [the average running time of QuickSort (with random pivots)](https://github.com/SSQ/Coursera-Stanford-Divide-and-Conquer-Sorting-and-Searching-and-Randomized-Algorithms/blob/master/Lecture%20Slides/6.3-slides_algo-qsort-analysis3_typed.pdf) 37 | - 7: Probability Review: 38 | 39 | - Week 4: 40 | - 8: Linear-time Selection 41 | - [Randomized Selection](https://github.com/SSQ/Coursera-Stanford-Divide-and-Conquer-Sorting-and-Searching-and-Randomized-Algorithms/blob/master/Lecture%20Slides/8.1-slides_algo-select-ralgorithm_typed.pdf) 42 | - [Deterministic Selection](https://github.com/SSQ/Coursera-Stanford-Divide-and-Conquer-Sorting-and-Searching-and-Randomized-Algorithms/blob/master/Lecture%20Slides/8.3-slides_algo-select-dalgorithm_typed.pdf) 43 | - 9: Graphs and The Minimum Cut 44 | - [Random Contraction Algorithm](https://github.com/SSQ/Coursera-Stanford-Divide-and-Conquer-Sorting-and-Searching-and-Randomized-Algorithms/blob/master/Lecture%20Slides/9.3-slides_algo-karger-algorithm_typed.pdf) 45 | - [x] [Implementation](https://github.com/SSQ/Coursera-Stanford-Divide-and-Conquer-Sorting-and-Searching-and-Randomized-Algorithms/tree/master/Programming%20Assignment%204) by Python 46 | 47 | ## 2. Graph Search, Shortest Paths, and Data Structures 48 | 49 | Course can be found in [Coursera](https://www.coursera.org/learn/algorithms-graphs-data-structures) 50 | 51 | Slides and more details about this course can be found in my Github [SSQ](https://github.com/SSQ/Coursera-Stanford-Graph-Search-Shortest-Paths-and-Data-Structures) 52 | 53 | - Week 1: 54 | - 10: Graph Search and Connectivity 55 | - [Generic Graph Search](https://github.com/SSQ/Coursera-Stanford-Graph-Search-Shortest-Paths-and-Data-Structures/blob/master/Lecture%20Slides/10.1-slides_algo-graphs-search_typed.pdf) 56 | - [Breadth-First Search (BFS)](https://github.com/SSQ/Coursera-Stanford-Graph-Search-Shortest-Paths-and-Data-Structures/blob/master/Lecture%20Slides/10.2-slides_algo-graphs-bfs_typed.pdf), [Application: Shortest Paths](https://github.com/SSQ/Coursera-Stanford-Graph-Search-Shortest-Paths-and-Data-Structures/blob/master/Lecture%20Slides/10.2-slides_algo-graphs-bfs_typed.pdf), [Application: Undirected Connectivity](https://github.com/SSQ/Coursera-Stanford-Graph-Search-Shortest-Paths-and-Data-Structures/blob/master/Lecture%20Slides/10.2-slides_algo-graphs-bfs_typed.pdf) 57 | - [Depth-First Search](https://github.com/SSQ/Coursera-Stanford-Graph-Search-Shortest-Paths-and-Data-Structures/blob/master/Lecture%20Slides/10.3-slides_algo-graphs-dfs_typed.pdf), [Application: Topological Sort](https://github.com/SSQ/Coursera-Stanford-Graph-Search-Shortest-Paths-and-Data-Structures/blob/master/Lecture%20Slides/10.3-slides_algo-graphs-dfs_typed.pdf) 58 | - Strongly Connected Components(SCC), [Kosaraju’s Two‐Pass Algorithm](https://github.com/SSQ/Coursera-Stanford-Graph-Search-Shortest-Paths-and-Data-Structures/blob/master/Lecture%20Slides/10.4-slides_algo-graphs-scc_typed.pdf) 59 | - [ ] [Implementation]() by Python 60 | - (Optional)[Structure of the Web](https://github.com/SSQ/Coursera-Stanford-Graph-Search-Shortest-Paths-and-Data-Structures/blob/master/Lecture%20Slides/10.6-slides_algo-graphs-web_typed.pdf) 61 | - Week 2: 62 | - 11: Dijkstra's Shortest-Path Algorithm 63 | - [Dijkstra’s Algorithm](https://github.com/SSQ/Coursera-Stanford-Graph-Search-Shortest-Paths-and-Data-Structures/blob/master/Lecture%20Slides/11.1-slides_algo-dijkstra-basics_typed.pdf), [Correctness](https://github.com/SSQ/Coursera-Stanford-Graph-Search-Shortest-Paths-and-Data-Structures/blob/master/Lecture%20Slides/11.2-slides_algo-dijkstra-correctness_typed.pdf), [Fast Implementation with Heap](https://github.com/SSQ/Coursera-Stanford-Graph-Search-Shortest-Paths-and-Data-Structures/blob/master/Lecture%20Slides/11.3-slides_algo-dijkstra-runtime_typed.pdf) 64 | - [x] [Implementation](https://github.com/SSQ/Coursera-Stanford-Graph-Search-Shortest-Paths-and-Data-Structures/tree/master/Programming%20Assignment%20%202) by Python 65 | - Week 3: 66 | - 12: Heaps 67 | - [Heap: Supported Operations; Application: Sorting; Application: Event Manager; Application: Median Maintenence; Application: Speeding Up Dijkstra](https://github.com/SSQ/Coursera-Stanford-Graph-Search-Shortest-Paths-and-Data-Structures/blob/master/Lecture%20Slides/12.2-slides_algo-ds-heaps-basics_typed.pdf) 68 | - [x] [Implementation Heap application: Median Maintenence](https://github.com/SSQ/Coursera-Stanford-Graph-Search-Shortest-Paths-and-Data-Structures/tree/master/Programming%20Assignment%203) by Python 69 | - [Array Implementation, Insert and Bubble‐Up, Extract‐Min and Bubble‐Down](https://github.com/SSQ/Coursera-Stanford-Graph-Search-Shortest-Paths-and-Data-Structures/blob/master/Lecture%20Slides/12.3-slides_algo-ds-heaps-guts_typed.pdf) 70 | - 13: Balanced Binary Search Trees 71 | - [Balanced Search Trees: Supported Operations](https://github.com/SSQ/Coursera-Stanford-Graph-Search-Shortest-Paths-and-Data-Structures/blob/master/Lecture%20Slides/13.1-slides_algo-ds-trees-ops-typed.pdf) 72 | - Binary Search Tree: [Searching and Inserting; Min, Max, Pred, And Succ; In-Order Traversal; Deletion; Select and Rank](https://github.com/SSQ/Coursera-Stanford-Graph-Search-Shortest-Paths-and-Data-Structures/blob/master/Lecture%20Slides/13.2-slides_algo-ds-trees-basics-typed.pdf) 73 | - Balanced Search Trees: [Red-Black](https://github.com/SSQ/Coursera-Stanford-Graph-Search-Shortest-Paths-and-Data-Structures/blob/master/Lecture%20Slides/13.3-slides_algo-ds-trees-redblack-typed.pdf) 74 | - (Optional)[Rotations: left rotation; right rotation](https://github.com/SSQ/Coursera-Stanford-Graph-Search-Shortest-Paths-and-Data-Structures/blob/master/Lecture%20Slides/13.4-slides_algo-ds-trees-rotations-annotated.pdf) 75 | - (Optional)[Insertion In A Red-Black Tree](https://github.com/SSQ/Coursera-Stanford-Graph-Search-Shortest-Paths-and-Data-Structures/blob/master/Lecture%20Slides/13.5-slides_algo-ds-trees-rbinsert-annotated.pdf) 76 | - Week 4: 77 | - 14: Hashing 78 | - [Hash Table: Supported Operations; Application: De‐Duplication; Application: The 2‐SUM Problem](https://github.com/SSQ/Coursera-Stanford-Graph-Search-Shortest-Paths-and-Data-Structures/blob/master/Lecture%20Slides/14.1-slides_algo-ds-hash-basics_typed.pdf) 79 | - [x] [Implementation](https://github.com/SSQ/Coursera-Stanford-Graph-Search-Shortest-Paths-and-Data-Structures/tree/master/Programming%20Assignment%204) by Python 80 | - [Resolving Collisions; Good Hash Function: Bad Hash Function](https://github.com/SSQ/Coursera-Stanford-Graph-Search-Shortest-Paths-and-Data-Structures/blob/master/Lecture%20Slides/14.2-slides_algo-ds-hash-guts_typed.pdf) 81 | - 15: Universal Hash Functions: 82 | - [Motivation](https://github.com/SSQ/Coursera-Stanford-Graph-Search-Shortest-Paths-and-Data-Structures/blob/master/Lecture%20Slides/15.1-slides_algo-ds-hash-universal1-typed.pdf) 83 | - 16: Bloom Filters 84 | - [Bloom Filters](https://github.com/SSQ/Coursera-Stanford-Graph-Search-Shortest-Paths-and-Data-Structures/blob/master/Lecture%20Slides/16.1-slides_algo-ds-bloom-typed.pdf) 85 | 86 | ## 3. Greedy Algorithms, Minimum Spanning Trees, and Dynamic Programming 87 | 88 | Course can be found in [Coursera](https://www.coursera.org/learn/algorithms-greedy) 89 | 90 | Slides and more details about this course can be found in my Github [SSQ](https://github.com/SSQ/Coursera-Stanford-Greedy-Algorithms-Minimum-Spanning-Trees-and-Dynamic-Programming) 91 | 92 | - Week 1: 93 | - [Greedy algorithm](https://github.com/SSQ/Coursera-Stanford-Greedy-Algorithms-Minimum-Spanning-Trees-and-Dynamic-Programming/blob/master/Lecture%20Slides/19.2-algo2-greedy-sched2-typed.pdf); 94 | - [Prim's Minimum Spanning Tree](https://github.com/SSQ/Coursera-Stanford-Greedy-Algorithms-Minimum-Spanning-Trees-and-Dynamic-Programming/blob/master/Lecture%20Slides/20.2-algo2-greedy-mst2-typed.pdf); 95 | - [x] [Implementation](https://github.com/SSQ/Coursera-Stanford-Greedy-Algorithms-Minimum-Spanning-Trees-and-Dynamic-Programming/tree/master/Programming%20Assignment%201) based on jupyter notebook. 96 | - Week 2: 97 | - [Kruskal's MST algorithm](https://github.com/SSQ/Coursera-Stanford-Greedy-Algorithms-Minimum-Spanning-Trees-and-Dynamic-Programming/blob/master/Lecture%20Slides/21.1-algo2-greedy-kruskal1-typed.pdf); 98 | - applications to [clustering](https://github.com/SSQ/Coursera-Stanford-Greedy-Algorithms-Minimum-Spanning-Trees-and-Dynamic-Programming/blob/master/Lecture%20Slides/22.1-algo2-greedy-kruskal5-typed.pdf); 99 | - [ ] [Implementation]() based on jupyter notebook; 100 | - advanced union-find (optional). 101 | - Week 3: 102 | - [Huffman's Algorithm](https://github.com/SSQ/Coursera-Stanford-Greedy-Algorithms-Minimum-Spanning-Trees-and-Dynamic-Programming/blob/master/Lecture%20Slides/24.3-algo2-greedy-huffman3-typed.pdf); 103 | - introduction to dynamic programming ([max weight](https://github.com/SSQ/Coursera-Stanford-Greedy-Algorithms-Minimum-Spanning-Trees-and-Dynamic-Programming/blob/master/Lecture%20Slides/25.3-algo2-dp-wis3-typed.pdf) [independent set](https://github.com/SSQ/Coursera-Stanford-Greedy-Algorithms-Minimum-Spanning-Trees-and-Dynamic-Programming/blob/master/Lecture%20Slides/25.4-algo2-dp-wis4-typed.pdf)); 104 | - [x] [Implementation](https://github.com/SSQ/Coursera-Stanford-Greedy-Algorithms-Minimum-Spanning-Trees-and-Dynamic-Programming/tree/master/Programming%20Assignment%203) based on jupyter notebook. 105 | - Week 4: 106 | - [Knapsack Algorithm](https://github.com/SSQ/Coursera-Stanford-Greedy-Algorithms-Minimum-Spanning-Trees-and-Dynamic-Programming/blob/master/Lecture%20Slides/26.2-algo2-dp-knapsack2-typed.pdf); 107 | - [x] [Implementation](https://github.com/SSQ/Coursera-Stanford-Greedy-Algorithms-Minimum-Spanning-Trees-and-Dynamic-Programming/tree/master/Programming%20Assignment%204) based on jupyter notebook; 108 | - [Sequence alignment](https://github.com/SSQ/Coursera-Stanford-Greedy-Algorithms-Minimum-Spanning-Trees-and-Dynamic-Programming/blob/master/Lecture%20Slides/27.2-algo2-dp-alignment2-typed.pdf); 109 | - [Optimal binary search trees](https://github.com/SSQ/Coursera-Stanford-Greedy-Algorithms-Minimum-Spanning-Trees-and-Dynamic-Programming/blob/master/Lecture%20Slides/28.4-algo2-dp-bst3-typed.pdf). 110 | --------------------------------------------------------------------------------