public static void binAllPath(Node root, Listls){ 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]]