mirror of
https://github.com/krahets/hello-algo.git
synced 2026-07-05 20:24:19 +00:00
Update the book based on the revised second edition (#1014)
* Revised the book * Update the book with the second revised edition * Revise base on the manuscript of the first edition
This commit is contained in:
@@ -29,7 +29,7 @@
|
||||
|
||||
设数组的长度为 $n$ ,冒泡排序的步骤如下图所示。
|
||||
|
||||
1. 首先,对 $n$ 个元素执行“冒泡”,**将数组的最大元素交换至正确位置**,
|
||||
1. 首先,对 $n$ 个元素执行“冒泡”,**将数组的最大元素交换至正确位置**。
|
||||
2. 接下来,对剩余 $n - 1$ 个元素执行“冒泡”,**将第二大元素交换至正确位置**。
|
||||
3. 以此类推,经过 $n - 1$ 轮“冒泡”后,**前 $n - 1$ 大的元素都被交换至正确位置**。
|
||||
4. 仅剩的一个元素必定是最小元素,无须排序,因此数组排序完成。
|
||||
|
||||
Reference in New Issue
Block a user