94. Binary Tree Inorder Traversal
Given a binary tree, return the inorder traversal of its nodes’ values.
For example :
Given binary tree[1, null, 2, 3],
1
\
2
/
3
return[1, 3, 2]
题意:
给定一个二叉树,实现二叉树的中序遍历的节点值。
思路:
方法一:
非递归实现。
1 | struct TreeNode { |
方法二:
递归实现。
1 | class Solution{ |