public static List<Integer> preorderTraversal(TreeNode root) {
		List<TreeNode> stack = new ArrayList<TreeNode>();
		List<Integer> res = new ArrayList<Integer>();
		TreeNode node = root;
		while (null != node || 0 != stack.size()) {
			while (null != node) {
				res.add(node.val);
				stack.add(node);
				node = node.left;
			}
			int size = stack.size();
			node = stack.remove(size - 1);
			node = node.right;
		}
		return res;
	}