Binary Tree Preorder Traversal
摘要:
Given a binary tree, return thepreordertraversal of its nodes' values.For example:Given binary tree{1,#,2,3}, 1 \ 2 / 3return[1,2,3].Note:Recursive solution is trivial, could you do it iteratively?如果不能使用recursive 那么就只能使用stack来保存状态。 1 /** 2 * Definition for binary tree 3 * public clas... 阅读全文
posted @ 2013-11-26 13:05 Step-BY-Step 阅读(192) 评论(0) 推荐(0)