mirror of
https://github.com/krahets/hello-algo.git
synced 2026-07-11 15:06:07 +00:00
Add Zig code blocks.
This commit is contained in:
@@ -232,6 +232,12 @@ comments: true
|
||||
}
|
||||
```
|
||||
|
||||
=== "Zig"
|
||||
|
||||
```zig title="bubble_sort.zig"
|
||||
|
||||
```
|
||||
|
||||
## 11.2.2. 算法特性
|
||||
|
||||
**时间复杂度 $O(n^2)$** :各轮「冒泡」遍历的数组长度为 $n - 1$ , $n - 2$ , $\cdots$ , $2$ , $1$ 次,求和为 $\frac{(n - 1) n}{2}$ ,因此使用 $O(n^2)$ 时间。
|
||||
@@ -458,3 +464,9 @@ comments: true
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
=== "Zig"
|
||||
|
||||
```zig title="bubble_sort.zig"
|
||||
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user