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
@@ -185,6 +185,12 @@ comments: true
```
=== "Swift"
```swift title="binary_tree_bfs.swift"
```
## 前序、中序、后序遍历
相对地,前、中、后序遍历皆属于「深度优先遍历 Depth-First Traversal」,其体现着一种“先走到尽头,再回头继续”的回溯遍历方式。
@@ -443,6 +449,12 @@ comments: true
}
```
=== "Swift"
```swift title="binary_tree_dfs.swift"
```
!!! note
使用循环一样可以实现前、中、后序遍历,但代码相对繁琐,有兴趣的同学可以自行实现。