Binary Tree Print all paths


    public static void binAllPath(Node root, List ls){
        if(root != null){
            if(root.left == null && root.right == null){
                List s = append(ls, root);
                printList(s); 
            }
            binAllPath(root.right, append(ls, root));
            binAllPath(root.left, append(ls, root));
        }
    }

    // OUTPUT
    [data=[10] data=[15]]
    [data=[10] data=[5] data=[9]]
    [data=[10] data=[5] data=[1]]