code-snippets
code-snippets copied to clipboard
My code snippets, mostly for blog https://writings.sh
algorithms
春水煎茶 - 王超的个人博客 的算法类文章的相关代码。
查找类:
- 二分查找 ....................................... binary-search
- 三分法求极值 ....................................... ternary-search-peak
- 有序二维矩阵搜索问题 ....................................... matrix-sorted-search
数组:
- 原地删除 ....................................... array-inplace-remove
- 原地移动零 ....................................... array-inplace-move-zeros
- 原地分割 ....................................... array-inplace-partition
- 原地分割三份 - 荷兰国旗问题 ....................................... array-inplace-partition
字符串:
- 字符串匹配 - KMP 算法 ....................................... string-search-kmp
- 字符串匹配 - Boyer Moore 算法 ....................................... string-search-boyer-moore
- 最长回文串 - Manacher 算法 ....................................... longest-palindromic-substring
数据结构:
- 堆 ....................................... data-structure-heap
- 哈希表 ....................................... data-structure-hashtable
- 链表 类问题 ....................................... data-structure-list
- 双头队列 ....................................... dequeue
- 栈 - 动态内存版 ....................................... stack-dynamic-mem
- 输出最小值的栈 ....................................... min-stack
- 输出最大值的队列 ....................................... max-queue
- 二叉树....................................... data-structure-binary-tree
- 字典树 ....................................... data-structure-trie
- 跳跃表 ..................... data-structure-skiplist
排序:
- 堆排序 ....................................... sort-heap-sort
- 快速排序 ....................................... sort-quick-sort
- 归并排序 ....................................... sort-merge-sort
数学类:
- 加减乘除四则运算 ....................................... math-four-operations
- 快速幂 ....................................... math-four-operations
- 平方根 ....................................... math-four-operations
- 辗转相除 ....................................... math-number-theory
- 素数筛法 ....................................... math-number-theory
- 快速素数筛法 ....................................... math-number-theory
随机化:
- 蓄水池抽样 ....................................... random-reservoir-sampling
- 洗牌算法 ....................................... random-shuffle
经典问题:
- 最长公共子串 ....................................... longest-common-substring
- 最长公共子序列 ....................................... longest-common-subsequence
- 最大连续子序列和 ....................................... largest-sum-contiguous-subarray
- 最长回文子串 ....................................... longest-palindromic-substring
- 最长回文子序列 ....................................... longest-palindromic-subsequence
- 最长递增子序列 ....................................... longest-increasing-subsequence
- 最大的 k 个数 - topk ....................................... top-k
- 字符串的全排列 ....................................... permutation
- 周期字符串 ....................................... repeated-string-pattern
- 无重复字符的最长子串 ....................................... longest-substring-without-repeat-chars
- 最短编辑距离 ....................................... min-edit-distance
- 校验表示数值的字符串 ....................................... validate-number-string
- 除自身以外数组的乘积 ....................................... product-of-array-except-self
- 倒酒问题/注水问题/分酒问题 ....................................... pour-problem