94. Binary Tree Inorder Traversal

来源:互联网 发布:一键获取淘宝联盟 编辑:程序博客网 时间:2024/06/10 03:29
 public static List<Integer> inorderTraversal(TreeNode root) {        List<Integer> list = new ArrayList<Integer>();        if(root == null) {            return list;        }else  {            ipoot(list,root);            return list;        }     }    public static void ipoot(List<Integer> list, TreeNode root) {        if(root == null) {            return;        }else {            ipoot(list,root.left);            list.add(root.val);            ipoot(list, root.right);        }    }
0 0
原创粉丝点击