Accepted iterative solution in Java using stack.
Note that in this solution only right children are stored to stack.\n\n    public List preorderTraversal(TreeNode node) {\n\t\tList list = new LinkedList();\n\t
Note that in this solution only right children are stored to stack.\n\n    public List<Integer> preorderTraversal(TreeNode node) {\n\t\tList<Integer> list = new LinkedList<Integer>();\n\t\tStack<TreeNode> rights = new Stack<TreeNode>();\n\t\twhile(node != null) {\n\t\t\tlist.add(node.val);\n\t\t\tif (node.right != null) {\n\t\t\t\trights.push(node.right);\n\t\t\t}\n\t\t\tnode = node.left;\n\t\t\tif (node == null && !rights.isEmpty()) {\n\t\t\t\tnode = rights.pop();\n\t\t\t}\n\t\t}\n        return list;\n    }
[]