private static <T> BinaryTree<T> reconstruct_pre_in_orders_helper(
            ArrayList<T> pre, int pre_s, int pre_e,
            ArrayList<T> in, int in_s, int in_e) {
        if(pre_e > pre_s && in_e > in_s) {
            int it = in.subList(in_s, in_e).indexOf(pre.get(pre_s));
            it = it < 0 ? in_e : (it + in_s);
            int left_tree_size = it - in_s;

            return new BinaryTree<T>(pre.get(pre_s),
                    reconstruct_pre_in_orders_helper(
                            pre, pre_s + 1, pre_s + 1 + left_tree_size,
                            in, in_s, it),
                    reconstruct_pre_in_orders_helper(
                            pre, pre_s + 1 + left_tree_size, pre_e,
                            in, it + 1, in_e));
        }
        return null;
    }