一.线索二叉树简介 二叉树本身是一种非线性结构,然而当你对二叉树进行遍历时,你会发现遍历结果是一个线性序列.这个序列中的节点存在前驱后继关系.因此,如何将这种前驱后继信息赋予给原本的二叉树呢?这就是二叉树的线索化过程.所以可以通过丰富原有的二叉树构建一棵可以知道结点的前驱后继的新的二叉树,我们叫它线索二叉树. 二.构建线索二叉树 2.1 定义线索二叉树节点 public class ThreadNode<E> { public E data; public ThreadNode<E>…
Nonrecursive Traversal of Binary Tree First I wanna talk about why we should <code>Stack</code> to implement this algorithm. I think it is due to the FILO feature, and that really matters and makes sense when you get around with tree stuff. Ca…