public static List<Integer> postorderTraversalnonrecursive (TreeNode root) {
        ArrayList<Integer> arrlst = new ArrayList<Integer>();
        if (root == null) return arrlst;
        Stack<TreeNode> stk = new Stack<TreeNode>();
        Stack<TreeNode> stk2 = new Stack<TreeNode>();
        stk.push(root);
        while (stk.isEmpty() == false) {
            TreeNode temp = stk.pop();
            stk2.push(temp);
            if (temp.left != null) stk.push(temp.left);
            if (temp.right != null) stk.push(temp.right);
        }
        while (stk2.isEmpty() == false) {
            arrlst.add(stk2.pop().val);
        }
        return arrlst;
    }