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…
import java.util.LinkedList; import java.util.Scanner; import java.util.Stack; //structure of binary tree class BiTree { BiTree lchild; BiTree rchild; String data; } public class BiTreeTest { static Scanner scanner = new Scanner(System.in); // test c…
[145-Binary Tree Postorder Traversal(二叉树非递归后序遍历)] [LeetCode-面试算法经典-Java实现][全部题目文件夹索引] 原题 Given a binary tree, return the postorder traversal of its nodes' values. For example: Given binary tree {1,#,2,3}, 1 \ 2 / 3 return [3,2,1]. Note: Recursive sol…