public List<Integer> postorderTraversal_II(TreeNode root) {
        List<Integer> res = new LinkedList<Integer>();
        if (root == null)
            return res;
        Stack<TreeNode> stack = new Stack<TreeNode>();
        TreeNode prev = null;
        while (!stack.isEmpty() || root != null) {
            if (root != null) {
                stack.push(root);
                root = root.left;
            } else {
                TreeNode peek = stack.peek();
                if (peek.right != null && prev != peek.right) {
                    root = peek.right;
                } else {
                    res.add(peek.val);
                    prev = stack.pop();
                    root = null;
                }
            }
        }
        return res;
    }