Add Dart codes to the documents. (#529)

This commit is contained in:
Yudong Jin
2023-06-02 02:40:26 +08:00
committed by GitHub
parent 041a989d33
commit 025051c81b
38 changed files with 849 additions and 96 deletions
+6
View File
@@ -105,6 +105,12 @@
[class]{}-[func]{selectionSort}
```
=== "Dart"
```dart title="selection_sort.dart"
[class]{}-[func]{selectionSort}
```
## 算法特性
- **时间复杂度为 $O(n^2)$ 、非自适应排序**:外循环共 $n - 1$ 轮,第一轮的未排序区间长度为 $n$ ,最后一轮的未排序区间长度为 $2$ ,即各轮外循环分别包含 $n$ , $n - 1$ , $\cdots$ , $2$ 轮内循环,求和为 $\frac{(n - 1)(n + 2)}{2}$ 。