When you understand something, then you can find the math to express that understanding. The math doesn't provide the understanding. The purpose of computing is insight, not numbers. The only real valuable thing is intuition.
by Leslie Lamport & Richard Hamming & Albert Einstein
- Insight: intuition, connect, debug
- Core: basics, application, best practice, typical problems, explanation, Q&A
- Map: problem type -> (data structure, design techniques) -> ways of thinking
problem type (11)
source: wiki
Every field of science has its own problems and needs efficient algorithms. Related problems in one field are often studied together.
Fields tend to overlap with each other, and algorithm advances in one field may improve those of other, sometimes completely unrelated, fields. For example, dynamic programming was invented for optimization of resource consumption in industry but is now used in solving a broad range of problems in many fields.
Field | Algorithms |
---|---|
Combinatorial/3 | General combinatorial, Graph, Sequence |
/general | |
/graph/5 | Graph drawing, Network theory, Routing for graphs, Graph search, Subgraphs |
//basics | coloring, Hopcroft–Karp, Hungarian, Prüfer coding, Tarjan's, topological-sort |
//drawing | |
//network theory | |
//routing | MST(Borůvka, prim, kruskal, Reverse-delete) |
//search | |
//subgraph | |
/sequence/9 | matching, selection, search, merge, permutations, alignment, sorting, subsequences, substrings |
//sorting | quicksort, mergesort, insertion-sort, heap-sort, counting-sort, selection-sort |
//selection | quickselect, introselect, median of medians |
//permutations | Fisher–Yates, |
//substrings | Longest common substring, substring search(Aho–Corasick, Boyer–Moore, KMP, Rabin–Karp, Zhu–Takaoka), Ukkonen-suffix-tree, matching wildcards |
Computational Math/ | Computer algebra, Geometry, Number theoretic algorithms, Numerical algorithms, Optimization |
/Optimization | ...dynamic programming... |
//-dynamic programming | string (longest common subsequence, longest increasing subsequence, longest common substring, edit distance), Kadane-maximum-subarray, graph (Viterbi, Floyd, TSP, Bellman–Ford), pseudo-polynomial time(subset sum, knapsack, partition), interval scheduling |
Computational science | |
... |
- binary/bit, string, array(hash), linked list, queue, stack
- set: disjoint set
- graph
- tree: binary tree, binary search tree, heap, trie, binary indexed tree, segment tree
- sequence, hash
- DFS, BFS
- Divide & conquer, DP, Greedy
- Binary search,Decrease & conquer,Dynamic & conquer
key 🔑 | typical problems👻 | video/gif 🎦 | notes 📒 |
---|---|---|---|
算法**❤️ | ❤️❤️ | ||
DFS | 🌟46. Permutations 👾112 Path系列, 👻105. Construct, 👹329. topological |
|
探测环 前序遍历 非递归 拓扑排序 树深 DFS with Memo 913 |
BFS | 🌟490.The Maze系列 👾107 level, 👻200 island, 👹269 alien |
遍历 块 最短路径 拓扑排序 |
|
Divide & conquer | 🌟23. Merge k Sorted Lists 👾53 Maximum, 👻932 Beautiful, 👹4 Median |
mergesort | |
DP | 🌟Stock系列 👾70 stairs, 👻416 subset, 👹140 words |
by Pramp |
choice variable sequence 最短路径(TSP) for/recursive counting string DP2DFS 背包416 股票系列 |
Greedy | 🌟402. Remove K Digits系列 👾455 cookies, 👻253 rooms, 👹135 candy |
minimum coins |
Heap Prim Kruskal 归纳 演绎 |
Transform & conquer | heap sort | ||
Decrease & conquer | 🌟240. Search a 2D Matrix II 169 majority, 78 subsets, 👹4 median |
by Anany |
减一技术 binary search size-decrease |
Binary Search | 🌟33. Search in Rotated Sorted Array 👾35 insert, 👻300 longest, 👹354 envelopes |
减治系列 搜索系列 |
- Induction & Deduction
- Recursion, Backtracking
- Two pointer, Siding window, Fast and slow
- Reverse thinking, Complement
key 🔑 | typical problems👻 | video/gif 🎦 | notes 📒 |
---|---|---|---|
思维方式🤔️ | 🤔️🤔️🤔️🤔️🤔️🤔️🤔️🤔️🤔️🤔️ | 🤔️🤔️🤔️🤔️🤔️ | 🤔️🤔️ |
Recursion? | 🌟894. All Possible Full Binary Trees 👾687 longest, 698 subsets, 248 strobogrammatic系列 |
+hashmap 递归公式 终止条件 |
|
Backtracking | 39. Combination Sum 401 watch, 22 parentheses, 51 n-queens |
集合 数迷 递归求解 触底反弹 |
|
Two Pointers | 🌟18. 4Sum 👾344 reverse 👻 11 container, 632 range |
|
|
Sliding Window | 🌟159. Longest Substring with At Most Two Distinct Characters 👾26 remove, 👻19 node, 👹76 substring |
|
满足自省 |
fast and slow | 287. Find the Duplicate Number 283 move zeros,142,? |
快慢指针 | |
Reverse thinking | 88, 795, 777, 👹803 | ||
Complement | 🌟930.Binary Subarrays With Sum 👾283 move, 👻921 add, 👹? |
930 |
Search:
- Leetcode题目全集: 便于多个标签过滤查找
- References: Related books and courses.
- Examples: Minimal and clean example implementations of data structures and algorithms in Python 3.
- repl/algorithms-by-field
Visualize:
- DS Visualizations
- Pythontutor: visualize Python, Java, JavaScript, C, C++, Ruby code execution
- Graph: create the graph from the adjacency list
- imagus: enlarge images from links with a mouse hover
- Visualizer: an interactive online platform that viualizes algorithms from code.
- codelike: given most animated view of data structures like binary tree, binary search tree, avl tree, red black tree, linked list and so on.
- mind-palace
Language:
- Python: A Python module for learning all major algorithms
- Java: 算法4精华笔记,通俗理解
- Javascript: Implemented in JavaScript with explanations and links to further readings
- Multi: Algorithm and data structure implementations in Python, C, C++ and Java
Practice:
- 50+: give you enough of an idea of the kinds of questions you can expect in a real programming job interview
- Leetcode: Practice real interview questions
- Pramp: Mock Interview
- @caomingkai
- @davidxkHeapg