private static <T> void connect_leaves_helper(BinaryTree<T> n, ArrayList<BinaryTree<T>> L) {
        if(n != null) {
            if(n.getLeft() == null && n.getRight() == null) {
                L.add(n);
            } else {
                connect_leaves_helper(n.getLeft(), L);
                connect_leaves_helper(n.getRight(), L);
            }
        }
    }