- Inspired by Big-O Algorithm Complexity Cheat Sheet @ericdrowell
- For the complexity representation
- 1 param:
$\Theta(avg.)$ - 2 params:
$\Theta(avg.)$ /$O(worst)$ - 3 params:
$\Omega(best)$ /$\Theta(avg.)$ /$O(worst)$
- 1 param:
| Name | 结构名 | Space | Access | Search | Insert | Delete | Note |
|---|---|---|---|---|---|---|---|
| Array | 数组 |
|
|
|
|
Swap with a[-1] => |
|
| Queue | 队列 |
|
|
|
|
||
| Stack | 栈 |
|
|
|
|
||
| Heap | 堆 | Check it in Heap Section | |||||
| Graph | 图 | Check it in Graph Section | |||||
| Singly-Linked List | 单向链表 |
|
|
|
|
||
| Doubly-Linked List | 双向链表 |
|
|
|
|
||
| Skip List | 跳跃表 |
|
|
|
|
||
| Hash Table | 哈希表 | - |
|
|
|
||
| Binary Search Tree | 二叉查找树 |
|
|
|
|
||
| Cartesian Tree | 笛卡尔树 | - |
|
|
|
||
| B-Tree | B 树 |
|
|
|
|
||
| Red-Black Tree | 红黑树 |
|
|
|
|
||
| Splay Tree | 伸展树 | - |
|
|
|
||
| AVL Tree | AVL 树 |
|
|
|
|
||
| KD Tree | K 维树 |
|
|
|
|
| Implementation | 结构名 | Heapify | Access Top | Pop Top | Increase Key | Insert | Delete | Merge |
|---|---|---|---|---|---|---|---|---|
| Linked List (Sorted) | 链表(已排序) | - | ||||||
| Linked List (Unsorted) | 链表(未排序) | - | ||||||
| Binary Heap | 二叉堆 | |||||||
| Binomial Heap | 二项堆 | - | ||||||
| Fibonacci Heap | 斐波那契堆 | - |
- Graph with
$\lvert{V}\rvert$ vertices and$\lvert{E}\rvert$ edges
| Vertex / Edge Management | 结构名 | Storage | Add Vertex | Add Edge | Remove Vertex | Remove Edge | Search |
|---|---|---|---|---|---|---|---|
| Adjacency List | 邻接表 | ||||||
| Incidence List | 关联表 | ||||||
| Adjacency Matrix | 邻接矩阵 | ||||||
| Incidence Matrix | 关联矩阵 |
| Name | 算法名 | Space | Time | Note |
|---|---|---|---|---|
| Quick Sort | 快速排序 |
|
Basic Unstable |
|
| Merge Sort | 归并排序 |
|
Basic Stable |
|
| Heap Sort | 堆排序 |
|
Basic Unstable |
|
| Bubble Sort | 冒泡排序 |
|
Basic Stable |
|
| Radix Sort | 基数排序 |
|
Basic Stable |
|
| Selection Sort | 选择排序 |
|
Basic Unstable |
|
| Shell Sort | 希尔排序 |
|
Basic Unstable |
|
| Insertion Sort | 插入排序 |
|
Basic Stable |
|
| Tim Sort | 提姆排序 |
|
Stable | |
| Bucket Sort | 桶排序 |
|
Stable | |
| Tree Sort | 树排序 |
|
||
| Counting Sort | 计数排序 |
|
Stable | |
| Cube Sort | 立方排序 |
|
Stable |
- Graph with
$\lvert{V}\rvert$ vertices and$\lvert{E}\rvert$ edges
| Name | 算法名 | Space | Time | Note |
|---|---|---|---|---|
| Depth First Search | 深度优先搜索 | - / |
||
| Breadth First Search | 广度优先搜索 | - / |
||
| Binary Search | 二分搜索 |
|
Sorted array of n elements | |
| Brute Force | 穷举搜索 |
|
Array | |
| Shortest path by Bellman-Ford |
|
|||
| Shortest path by Dijkstra (Min-heap) |
|
|||
| Shortest path by Dijkstra (Unordered Array) |
|