Add Swift language blocks to the docs.

This commit is contained in:
Yudong Jin
2023-01-08 19:41:05 +08:00
parent 3ba37dba3a
commit 73e3452838
22 changed files with 414 additions and 70 deletions
+12
View File
@@ -212,6 +212,12 @@ comments: true
}
```
=== "Swift"
```swift title="bubble_sort.swift"
```
## 算法特性
**时间复杂度 $O(n^2)$ :** 各轮「冒泡」遍历的数组长度为 $n - 1$ , $n - 2$ , $\cdots$ , $2$ , $1$ 次,求和为 $\frac{(n - 1) n}{2}$ ,因此使用 $O(n^2)$ 时间。
@@ -414,3 +420,9 @@ comments: true
}
}
```
=== "Swift"
```swift title="bubble_sort.swift"
```