Bug fixes and improvements. (#1780)

* Fix the "尾递归优化" to "递归深度优化" in quick_sort.

* Update landing pages.

* Sync zh and zh-hant versions.

* Sync zh and zh-hant versions.
This commit is contained in:
Yudong Jin
2025-07-10 06:32:25 +08:00
committed by GitHub
parent 6a4d62449c
commit e8dc4736a2
43 changed files with 173 additions and 165 deletions
+1 -1
View File
@@ -89,7 +89,7 @@
[file]{quick_sort}-[class]{quick_sort_median}-[func]{partition}
```
## 递归优化
## 递归深度优化
**在某些输入下,快速排序可能占用空间较多**。以完全有序的输入数组为例,设递归中的子数组长度为 $m$ ,每轮哨兵划分操作都将产生长度为 $0$ 的左子数组和长度为 $m - 1$ 的右子数组,这意味着每一层递归调用减少的问题规模非常小(只减少一个元素),递归树的高度会达到 $n - 1$ ,此时需要占用 $O(n)$ 大小的栈帧空间。