由买买提看人间百态

topics

全部话题 - 话题: treenode2
(共0页)
a*********8
发帖数: 140
1
来自主题: JobHunting版 - 请教两道F面试题的follow up
用recursion和post order的stack,做第一题:
class TreeNode2 {
char val;
TreeNode2 left;
TreeNode2 right;
TreeNode2(char val){
this.val = val;
}
}
public class Exercise2 {
public List pathRootToLeaf(TreeNode2 root){
List list = new ArrayList();
if (root == null){
return list;
}

List left = pathRootToLeaf(root.left);
List right = pathRootToLeaf(root.right);

i... 阅读全帖
(共0页)