mirror of
https://github.com/krahets/hello-algo.git
synced 2026-07-10 14:36:06 +00:00
Add Swift language blocks to the docs.
This commit is contained in:
@@ -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
|
||||
|
||||
使用循环一样可以实现前、中、后序遍历,但代码相对繁琐,有兴趣的同学可以自行实现。
|
||||
|
||||
Reference in New Issue
Block a user