java创建二叉树并递归遍历二叉树前面已有讲解:http://www.cnblogs.com/lixiaolun/p/4658659.html. 在此基础上添加了非递归中序遍历二叉树: 二叉树类的代码: package binarytree; import linkedstack.LinkStack; import linkqueue.LinkQueue; public class BinaryTree { class Node { public Object data; public Node…
Given a binary tree, return the inorder traversal of its nodes' values. For example: Given binary tree [1,null,2,3], 1 \ 2 / 3 return [1,3,2]. Note: Recursive(递归) solution is trivial, could you do it iteratively(迭代)? 思路: 解法一:用递归方法很简单, (1)如果root为空,则返回…