Data Structures & Algorithms
237 notes
Some notes are currently available only in Chinese. English translations are shown when available.
- Longest Substring Without Repeating Charactershistorical
Given an array, return the length of its longest contiguous subarray without repeated elements.
- 2.18 Sparse Indexhistorical
A sparse index stores entries for only some keys, using less space than a dense index. These notes compare their structures, lookup methods, and usage conditions.
- 2.19 Indexhistorical
An index associates search keys with data records to speed up lookups. These notes compare sparse and dense indexes, as well as forward and inverted indexes.
- 2.20 Inverted Indexhistorical
A forward index maps document IDs to documents, while an inverted index maps terms to document IDs to find documents containing a given term.
- 3.1 Cache Replacement Policieshistorical
Caches have limited space and must evict data when full. These notes compare how strategies such as FIFO and LRU choose what to retain or remove.
- 3.2 Dynamic Programminghistorical
Dynamic programming can be derived from recursion and memoization. These notes use path-counting examples to explain states, transitions, and optimal substructure.
- 3.3 Greedyhistorical
A greedy algorithm makes the best available choice at each step. These notes explore this approach through loading and coin-change problems.
- 3.4 Divide and Conquerhistorical
Divide and conquer splits a problem into smaller problems of the same structure, solves them recursively, and combines their results.
- 3.5 Recursionhistorical
Recursion lets a function call itself, breaking a problem into smaller cases until they can be solved directly and their results returned through the call chain.
- Edit Distancehistorical
Given two words word1 and word2, calculate the minimum number of operations required to convert word1 into word2.