标签:
本题就是树的中序遍历过程。/** * Definition for a binary tree node. * public class TreeNode { * public int val; * public TreeNode left; * public TreeNode right; * public TreeNode(int x) { val = x; } * } */ public class Solution { public IList<int> InorderTraversal(TreeNode root) { Travel(root); return result; } private void Travel(TreeNode node){ if(node == null){ return ; } Travel(node.left); result.Add(node.val); Travel(node.right); } private IList<int> result = new List<int>(); }
版权声明:本文为博主原创文章,未经博主允许不得转载。
LeetCode -- Binary Tree Inorder Traversal
标签:
原文地址:http://blog.csdn.net/lan_liang/article/details/48575897