Skip to content

Commit 6d81951

Browse files
authored
Add Chinise Translation (trekhleb#842)
1 parent 42c6718 commit 6d81951

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

src/algorithms/sorting/quick-sort/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Quicksort
22

3+
_Read this in other languages:_
4+
[_简体中文_](README.zh-CN.md)
5+
6+
37
Quicksort is a divide and conquer algorithm.
48
Quicksort first divides a large array into two smaller
59
sub-arrays: the low elements and the high elements.
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# 快速排序
2+
3+
快速排序是一种分而治之的算法。快速排序首先将一个大数组分成两个较小的子数组:比某个数小的元素和比某个数大的元素。然后快速排序可以递归地对子数组进行排序。
4+
5+
步骤是:
6+
7+
1. 从数组中选择一个元素,称为基点
8+
9+
2. 分区:对数组重新排序,使所有值小于基点的元素都在它左边,而所有值大于基点的元素都在它右边(相等的值可以放在任何一边)。在此分区之后,基点处于其最终位置(左边和右边的中间位置)。这称为分区操作。
10+
11+
3. 递归地将上述步骤应用于左边的数组和右边的数组。
12+
13+
快速排序算法的动画可视化。水平线是基点值。
14+
15+
![Quicksort](https://upload.wikimedia.org/wikipedia/commons/6/6a/Sorting_quicksort_anim.gif)
16+
17+
## 复杂度
18+
19+
| Name | Best | Average | Worst | Memory | Stable | Comments |
20+
| -------------- | :-----------: | :-----------: | :-----------: | :----: | :----: | :------------------------------------------------------------ |
21+
| **Quick sort** | n&nbsp;log(n) | n&nbsp;log(n) | n<sup>2</sup> | log(n) | No | Quicksort is usually done in-place with O(log(n)) stack space |
22+
23+
## 引用
24+
25+
- [Wikipedia](https://en.wikipedia.org/wiki/Quicksort)
26+
27+
- [YouTube](https://www.youtube.com/watch?v=SLauY6PpjW4&index=28&list=PLLXdhg_r2hKA7DPDsunoDZ-Z769jWn4R8)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy