Skip to content

Commit 2a19dbe

Browse files
authored
Update 1.bubbleSort.md
1 parent 6516bb8 commit 2a19dbe

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

1.bubbleSort.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@
3535

3636
设初始文件是反序的,需要进行 n-1 趟排序。每趟排序要进行 n-i 次关键字的比较(1≤i≤n-1),且每次比较都必须移动记录三次来达到交换记录位置。在这种情况下,比较和移动次数均达到最大值:
3737

38-
$$ 比较:C_{max} = \frac{n(n-1)}{2} = O(n^2)$$
39-
$$ 移动:M_{max} = \frac{3n(n-1)}{2} = O(n^2)$$
38+
比较: $$ C_{max} = \frac{n(n-1)}{2} = O(n^2) $$
39+
移动: $$ M_{max} = \frac{3n(n-1)}{2} = O(n^2) $$
4040

4141
冒泡排序的最坏时间复杂度为$$ O(n^2)$$
4242
综上,因此冒泡排序总的平均时间复杂度为$$ O(n^2)$$

0 commit comments

Comments
 (0)