public List<Integer> postorderTraversal(TreeNode root) {
			
			List<Integer> res =  new ArrayList<Integer>();
			if (root==null) return res;
			TreeNode pre = null;
			TreeNode cur = root;
			Stack<TreeNode> s =  new Stack<TreeNode>();
			s.push(root);
			while (!s.isEmpty())
			{
				cur = s.pop();
				if((cur.right==null&& cur.left==null) || (pre!=null && (pre==cur.left||pre==cur.right)))
				{
					res.add(cur.val);
					pre = cur;
				}else 
				{
					s.push(cur);
					if(cur.right!=null) s.push(cur.right);
					if(cur.left!=null) s.push(cur.left);	
				}
			}			
			return res;	
	}