mirror of
https://github.com/youngyangyang04/leetcode-master.git
synced 2025-07-08 16:54:50 +08:00
@ -221,7 +221,7 @@ class Solution:
|
||||
Go:
|
||||
|
||||
前序遍历:
|
||||
```
|
||||
```go
|
||||
func PreorderTraversal(root *TreeNode) (res []int) {
|
||||
var traversal func(node *TreeNode)
|
||||
traversal = func(node *TreeNode) {
|
||||
@ -239,7 +239,7 @@ func PreorderTraversal(root *TreeNode) (res []int) {
|
||||
```
|
||||
中序遍历:
|
||||
|
||||
```
|
||||
```go
|
||||
func InorderTraversal(root *TreeNode) (res []int) {
|
||||
var traversal func(node *TreeNode)
|
||||
traversal = func(node *TreeNode) {
|
||||
@ -256,7 +256,7 @@ func InorderTraversal(root *TreeNode) (res []int) {
|
||||
```
|
||||
后序遍历:
|
||||
|
||||
```
|
||||
```go
|
||||
func PostorderTraversal(root *TreeNode) (res []int) {
|
||||
var traversal func(node *TreeNode)
|
||||
traversal = func(node *TreeNode) {
|
||||
|
Reference in New Issue
Block a user