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
@@ -76,6 +76,12 @@
[class]{}-[func]{levelOrder}
```
=== "Dart"
```dart title="binary_tree_bfs.dart"
[class]{}-[func]{levelOrder}
```
### 复杂度分析
**时间复杂度**:所有节点被访问一次,使用 $O(n)$ 时间,其中 $n$ 为节点数量。
@@ -202,6 +208,16 @@
[class]{}-[func]{postOrder}
```
=== "Dart"
```dart title="binary_tree_dfs.dart"
[class]{}-[func]{preOrder}
[class]{}-[func]{inOrder}
[class]{}-[func]{postOrder}
```
!!! note
我们也可以仅基于循环实现前、中、后序遍历,有兴趣的同学可以自行实现。