Skip to content

Commit

Permalink
update hash table
Browse files Browse the repository at this point in the history
  • Loading branch information
2xiao committed Nov 11, 2023
1 parent 26999d7 commit 1d27df0
Show file tree
Hide file tree
Showing 97 changed files with 1,469 additions and 230 deletions.
Binary file added assets/images/705.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
File renamed without changes.
6 changes: 3 additions & 3 deletions assets/scripts/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ def format_difficulty(difficulty: str, show_emoji: bool = False):
font = ""
emoji = ""
if difficulty == "困难":
emoji = "🔴"
emoji = "🌶"
font = "<font color=#ff334b>Hard</font>"
elif difficulty == "中等":
emoji = "🟠"
emoji = "🍊"
font = "<font color=#ffb800>Medium</font>"
elif difficulty == "简单":
emoji = "🟢"
emoji = "🍏"
font = "<font color=#15bd66>Esay</font>"
if show_emoji:
return emoji + " " + font
Expand Down
2 changes: 2 additions & 0 deletions docs/.vuepress/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,8 @@ function genLeetCode() {
sidebarDepth: 0,
children: [
"/leetcode/solution/0700-0799.md",
"/leetcode/problem/0705.md",
"/leetcode/problem/0706.md",
"/leetcode/problem/0707.md",
"/leetcode/problem/0724.md",
"/leetcode/problem/0739.md"
Expand Down
124 changes: 63 additions & 61 deletions docs/leetcode/algorithm/7_sort.md
Original file line number Diff line number Diff line change
Expand Up @@ -333,89 +333,91 @@ function swap(arr, i, j) {
<!-- Please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN `npm run lc` TO UPDATE -->


## 相关题目

#### 数组排序

- 冒泡排序
* 冒泡排序

| 题号 | 标题 | 题解 | 标签 | 难度 |
| :------: | :------ | :------: | :------ | :------ |
| 剑指 Offer 45 | [把数组排成最小的数](https://leetcode.cn/problems/ba-shu-zu-pai-cheng-zui-xiao-de-shu-lcof/) | | `贪心` `字符串` `排序` | <font color=#ffb800>Medium</font> |
| 0283 | [移动零](https://leetcode.com/problems/move-zeroes/) | [JS](https://2xiao.github.io/leetcode-js/leetcode/problem/0283) | `数组` `双指针` | <font color=#15bd66>Esay</font> |

| 题号 | 标题 | 题解 | 标签 | 难度 |
| :-----------: | :------------------------------------------------------------------------------------------- | :-------------------------------------------------------------: | :--------------------- | :-------------------------------- |
| 剑指 Offer 45 | [把数组排成最小的数](https://leetcode.cn/problems/ba-shu-zu-pai-cheng-zui-xiao-de-shu-lcof/) | | `贪心` `字符串` `排序` | <font color=#ffb800>Medium</font> |
| 0283 | [移动零](https://leetcode.com/problems/move-zeroes/) | [JS](https://2xiao.github.io/leetcode-js/leetcode/problem/0283) | `数组` `双指针` | <font color=#15bd66>Esay</font> |
* 选择排序

- 选择排序
| 题号 | 标题 | 题解 | 标签 | 难度 |
| :------: | :------ | :------: | :------ | :------ |
| 0215 | [数组中的第K个最大元素](https://leetcode.com/problems/kth-largest-element-in-an-array/) | | `数组` `分治` `快速选择` `2+` | <font color=#ffb800>Medium</font> |

| 题号 | 标题 | 题解 | 标签 | 难度 |
| :--: | :---------------------------------------------------------------------------------------- | :--: | :---------------------------- | :-------------------------------- |
| 0215 | [数组中的第 K 个最大元素](https://leetcode.com/problems/kth-largest-element-in-an-array/) | | `数组` `分治` `快速选择` `2+` | <font color=#ffb800>Medium</font> |
* 插入排序

- 插入排序
| 题号 | 标题 | 题解 | 标签 | 难度 |
| :------: | :------ | :------: | :------ | :------ |
| 0075 | [颜色分类](https://leetcode.com/problems/sort-colors/) | | `数组` `双指针` `排序` | <font color=#ffb800>Medium</font> |

| 题号 | 标题 | 题解 | 标签 | 难度 |
| :--: | :----------------------------------------------------- | :--: | :--------------------- | :-------------------------------- |
| 0075 | [颜色分类](https://leetcode.com/problems/sort-colors/) | | `数组` `双指针` `排序` | <font color=#ffb800>Medium</font> |
* 希尔排序

- 希尔排序
| 题号 | 标题 | 题解 | 标签 | 难度 |
| :------: | :------ | :------: | :------ | :------ |
| 0912 | [排序数组](https://leetcode.com/problems/sort-an-array/) | | `数组` `分治` `桶排序` `5+` | <font color=#ffb800>Medium</font> |
| 0506 | [相对名次](https://leetcode.com/problems/relative-ranks/) | | `数组` `排序` `堆(优先队列)` | <font color=#15bd66>Esay</font> |

| 题号 | 标题 | 题解 | 标签 | 难度 |
| :--: | :-------------------------------------------------------- | :--: | :----------------------------- | :-------------------------------- |
| 0912 | [排序数组](https://leetcode.com/problems/sort-an-array/) | | `数组` `分治` `桶排序` `5+` | <font color=#ffb800>Medium</font> |
| 0506 | [相对名次](https://leetcode.com/problems/relative-ranks/) | | `数组` `排序` `堆(优先队列)` | <font color=#15bd66>Esay</font> |
* 归并排序

- 归并排序
| 题号 | 标题 | 题解 | 标签 | 难度 |
| :------: | :------ | :------: | :------ | :------ |
| 0912 | [排序数组](https://leetcode.com/problems/sort-an-array/) | | `数组` `分治` `桶排序` `5+` | <font color=#ffb800>Medium</font> |
| 0088 | [合并两个有序数组](https://leetcode.com/problems/merge-sorted-array/) | | `数组` `双指针` `排序` | <font color=#15bd66>Esay</font> |
| 剑指 Offer 51 | [数组中的逆序对](https://leetcode.cn/problems/shu-zu-zhong-de-ni-xu-dui-lcof/) | | `树状数组` `线段树` `数组` `4+` | <font color=#ff334b>Hard</font> |
| 0315 | [计算右侧小于当前元素的个数](https://leetcode.com/problems/count-of-smaller-numbers-after-self/) | | `树状数组` `线段树` `数组` `4+` | <font color=#ff334b>Hard</font> |

| 题号 | 标题 | 题解 | 标签 | 难度 |
| :-----------: | :----------------------------------------------------------------------------------------------- | :--: | :------------------------------ | :-------------------------------- |
| 0912 | [排序数组](https://leetcode.com/problems/sort-an-array/) | | `数组` `分治` `桶排序` `5+` | <font color=#ffb800>Medium</font> |
| 0088 | [合并两个有序数组](https://leetcode.com/problems/merge-sorted-array/) | | `数组` `双指针` `排序` | <font color=#15bd66>Esay</font> |
| 剑指 Offer 51 | [数组中的逆序对](https://leetcode.cn/problems/shu-zu-zhong-de-ni-xu-dui-lcof/) | | `树状数组` `线段树` `数组` `4+` | <font color=#ff334b>Hard</font> |
| 0315 | [计算右侧小于当前元素的个数](https://leetcode.com/problems/count-of-smaller-numbers-after-self/) | | `树状数组` `线段树` `数组` `4+` | <font color=#ff334b>Hard</font> |
* 快速排序

- 快速排序
| 题号 | 标题 | 题解 | 标签 | 难度 |
| :------: | :------ | :------: | :------ | :------ |
| 0912 | [排序数组](https://leetcode.com/problems/sort-an-array/) | | `数组` `分治` `桶排序` `5+` | <font color=#ffb800>Medium</font> |
| 0169 | [多数元素](https://leetcode.com/problems/majority-element/) | | `数组` `哈希表` `分治` `2+` | <font color=#15bd66>Esay</font> |

| 题号 | 标题 | 题解 | 标签 | 难度 |
| :--: | :---------------------------------------------------------- | :--: | :-------------------------- | :-------------------------------- |
| 0912 | [排序数组](https://leetcode.com/problems/sort-an-array/) | | `数组` `分治` `桶排序` `5+` | <font color=#ffb800>Medium</font> |
| 0169 | [多数元素](https://leetcode.com/problems/majority-element/) | | `数组` `哈希表` `分治` `2+` | <font color=#15bd66>Esay</font> |
* 堆排序

- 堆排序
| 题号 | 标题 | 题解 | 标签 | 难度 |
| :------: | :------ | :------: | :------ | :------ |
| 0912 | [排序数组](https://leetcode.com/problems/sort-an-array/) | | `数组` `分治` `桶排序` `5+` | <font color=#ffb800>Medium</font> |
| 0215 | [数组中的第K个最大元素](https://leetcode.com/problems/kth-largest-element-in-an-array/) | | `数组` `分治` `快速选择` `2+` | <font color=#ffb800>Medium</font> |
| 剑指 Offer 40 | [最小的k个数](https://leetcode.cn/problems/zui-xiao-de-kge-shu-lcof/) | | `数组` `分治` `快速选择` `2+` | <font color=#15bd66>Esay</font> |

| 题号 | 标题 | 题解 | 标签 | 难度 |
| :-----------: | :---------------------------------------------------------------------------------------- | :--: | :---------------------------- | :-------------------------------- |
| 0912 | [排序数组](https://leetcode.com/problems/sort-an-array/) | | `数组` `分治` `桶排序` `5+` | <font color=#ffb800>Medium</font> |
| 0215 | [数组中的第 K 个最大元素](https://leetcode.com/problems/kth-largest-element-in-an-array/) | | `数组` `分治` `快速选择` `2+` | <font color=#ffb800>Medium</font> |
| 剑指 Offer 40 | [最小的 k 个数](https://leetcode.cn/problems/zui-xiao-de-kge-shu-lcof/) | | `数组` `分治` `快速选择` `2+` | <font color=#15bd66>Esay</font> |
* 计数排序

- 计数排序
| 题号 | 标题 | 题解 | 标签 | 难度 |
| :------: | :------ | :------: | :------ | :------ |
| 0912 | [排序数组](https://leetcode.com/problems/sort-an-array/) | | `数组` `分治` `桶排序` `5+` | <font color=#ffb800>Medium</font> |
| 1122 | [数组的相对排序](https://leetcode.com/problems/relative-sort-array/) | | `数组` `哈希表` `计数排序` `1+` | <font color=#15bd66>Esay</font> |

| 题号 | 标题 | 题解 | 标签 | 难度 |
| :--: | :------------------------------------------------------------------- | :--: | :------------------------------ | :-------------------------------- |
| 0912 | [排序数组](https://leetcode.com/problems/sort-an-array/) | | `数组` `分治` `桶排序` `5+` | <font color=#ffb800>Medium</font> |
| 1122 | [数组的相对排序](https://leetcode.com/problems/relative-sort-array/) | | `数组` `哈希表` `计数排序` `1+` | <font color=#15bd66>Esay</font> |
* 桶排序

- 桶排序
| 题号 | 标题 | 题解 | 标签 | 难度 |
| :------: | :------ | :------: | :------ | :------ |
| 0912 | [排序数组](https://leetcode.com/problems/sort-an-array/) | | `数组` `分治` `桶排序` `5+` | <font color=#ffb800>Medium</font> |
| 0220 | [存在重复元素 III](https://leetcode.com/problems/contains-duplicate-iii/) | | `数组` `桶排序` `有序集合` `2+` | <font color=#ff334b>Hard</font> |
| 0164 | [最大间距](https://leetcode.com/problems/maximum-gap/) | | `数组` `桶排序` `基数排序` `1+` | <font color=#ff334b>Hard</font> |

| 题号 | 标题 | 题解 | 标签 | 难度 |
| :--: | :------------------------------------------------------------------------ | :--: | :------------------------------ | :-------------------------------- |
| 0912 | [排序数组](https://leetcode.com/problems/sort-an-array/) | | `数组` `分治` `桶排序` `5+` | <font color=#ffb800>Medium</font> |
| 0220 | [存在重复元素 III](https://leetcode.com/problems/contains-duplicate-iii/) | | `数组` `桶排序` `有序集合` `2+` | <font color=#ff334b>Hard</font> |
| 0164 | [最大间距](https://leetcode.com/problems/maximum-gap/) | | `数组` `桶排序` `基数排序` `1+` | <font color=#ff334b>Hard</font> |
* 基数排序

- 基数排序
| 题号 | 标题 | 题解 | 标签 | 难度 |
| :------: | :------ | :------: | :------ | :------ |
| 0164 | [最大间距](https://leetcode.com/problems/maximum-gap/) | | `数组` `桶排序` `基数排序` `1+` | <font color=#ff334b>Hard</font> |
| 0561 | [数组拆分](https://leetcode.com/problems/array-partition/) | | `贪心` `数组` `计数排序` `1+` | <font color=#15bd66>Esay</font> |

| 题号 | 标题 | 题解 | 标签 | 难度 |
| :--: | :--------------------------------------------------------- | :--: | :------------------------------ | :------------------------------ |
| 0164 | [最大间距](https://leetcode.com/problems/maximum-gap/) | | `数组` `桶排序` `基数排序` `1+` | <font color=#ff334b>Hard</font> |
| 0561 | [数组拆分](https://leetcode.com/problems/array-partition/) | | `贪心` `数组` `计数排序` `1+` | <font color=#15bd66>Esay</font> |
* 其他排序

- 其他排序
| 题号 | 标题 | 题解 | 标签 | 难度 |
| :------: | :------ | :------: | :------ | :------ |
| 0217 | [存在重复元素](https://leetcode.com/problems/contains-duplicate/) | | `数组` `哈希表` `排序` | <font color=#15bd66>Esay</font> |
| 0136 | [只出现一次的数字](https://leetcode.com/problems/single-number/) | | `位运算` `数组` | <font color=#15bd66>Esay</font> |
| 0056 | [合并区间](https://leetcode.com/problems/merge-intervals/) | | `数组` `排序` | <font color=#ffb800>Medium</font> |
| 0179 | [最大数](https://leetcode.com/problems/largest-number/) | | `贪心` `数组` `字符串` `1+` | <font color=#ffb800>Medium</font> |
| 0384 | [打乱数组](https://leetcode.com/problems/shuffle-an-array/) | | `数组` `数学` `随机化` | <font color=#ffb800>Medium</font> |
| 剑指 Offer 45 | [把数组排成最小的数](https://leetcode.cn/problems/ba-shu-zu-pai-cheng-zui-xiao-de-shu-lcof/) | | `贪心` `字符串` `排序` | <font color=#ffb800>Medium</font> |

| 题号 | 标题 | 题解 | 标签 | 难度 |
| :-----------: | :------------------------------------------------------------------------------------------- | :--: | :-------------------------- | :-------------------------------- |
| 0217 | [存在重复元素](https://leetcode.com/problems/contains-duplicate/) | | `数组` `哈希表` `排序` | <font color=#15bd66>Esay</font> |
| 0136 | [只出现一次的数字](https://leetcode.com/problems/single-number/) | | `位运算` `数组` | <font color=#15bd66>Esay</font> |
| 0056 | [合并区间](https://leetcode.com/problems/merge-intervals/) | | `数组` `排序` | <font color=#ffb800>Medium</font> |
| 0179 | [最大数](https://leetcode.com/problems/largest-number/) | | `贪心` `数组` `字符串` `1+` | <font color=#ffb800>Medium</font> |
| 0384 | [打乱数组](https://leetcode.com/problems/shuffle-an-array/) | | `数组` `数学` `随机化` | <font color=#ffb800>Medium</font> |
| 剑指 Offer 45 | [把数组排成最小的数](https://leetcode.cn/problems/ba-shu-zu-pai-cheng-zui-xiao-de-shu-lcof/) | | `贪心` `字符串` `排序` | <font color=#ffb800>Medium</font> |
Loading

0 comments on commit 1d27df0

Please sign in to comment.