public List<Integer> postorderStack(TreeNode root) {
		ArrayList<Integer> list = new ArrayList<Integer>();
		if (root == null)
			return list;
		Stack<TreeNode> stack = new Stack<TreeNode>();
		stack.push(root);
		TreeNode pre = null;
		while (!stack.empty()) {
			TreeNode cur = stack.peek();
			if ((cur.left == null && cur.right == null) || 
				(pre != null && (pre == cur.left || pre == cur.right))) {
				list.add(cur.val);
				stack.pop();
				pre = cur;
			}else {
				if (cur.right != null)
					stack.push(cur.right);
				if (cur.left != null)
					stack.push(cur.left);
			}
		}
		return list;
	}