mirror of
https://github.com/krahets/hello-algo.git
synced 2026-07-21 19:06:11 +00:00
Add Dart codes to the documents. (#529)
This commit is contained in:
@@ -131,6 +131,14 @@
|
||||
[class]{}-[func]{mergeSort}
|
||||
```
|
||||
|
||||
=== "Dart"
|
||||
|
||||
```dart title="merge_sort.dart"
|
||||
[class]{}-[func]{merge}
|
||||
|
||||
[class]{}-[func]{mergeSort}
|
||||
```
|
||||
|
||||
合并方法 `merge()` 代码中的难点包括:
|
||||
|
||||
- **在阅读代码时,需要特别注意各个变量的含义**。`nums` 的待合并区间为 `[left, right]` ,但由于 `tmp` 仅复制了 `nums` 该区间的元素,因此 `tmp` 对应区间为 `[0, right - left]` 。
|
||||
|
||||
Reference in New Issue
Block a user