描述
Given a binary tree, return the inorder traversal of its nodes’ values.
For example:
Given binary tree {1,#,2,3},
1 | 1 |
return [1,3,2].
分析
中序遍历,利用堆栈即可解决
解决方案1(C++)
1 | /** |
解决方案2(Golang)
1 | /** |
相关问题
- (M) Kth Smallest Element in a BST
- (M) Validate Binary Search Tree
- (H) Closest Binary Search Tree Value II
- (M) Binary Tree Preorder Traversal
- (H) Binary Tree Postorder Traversal
- (M) Binary Search Tree Iterator
- (M) Inorder Successor in BST