线索二叉树-概念 当用二叉链表作为二叉树的存储结构时,因为每个结点中只有指向其左、右儿子结点的指针,所以从任一结点出发只能直接找到该结点的左、右儿子。在一般情况下靠它无法直接找到该结点在某种遍历序下的前驱和后继结点
来源:http://www.cnblogs.com/JCSU/articles/2005967.html /***************************************************************************
来源:http://www.cnblogs.com/JCSU/articles/2005967.html /************************************************************************
ThreadNode.h template<typename Type> class ThreadTree; template<typename Type> class ThreadInorderIterator; template<typename Type
ThreadNode.h template<typename Type> class ThreadTree; template<typename Type> class ThreadInorderIterator; template<typename Type
n个结点的二叉链表中含有n+1(2n-(n-1)=n+1)个空指针域。利用二叉链表中的空指针域,存放指向结点在某种遍历次序下的前趋和后继结点的指针(这种附加的指针称为"线索")。
//后序线索,这种方法不容易想到 1 #include<iostream> 2 #include<cstring> 3 #include<cstdio> 4 #include<algorithm> 5 6 using namespace std; 7 8
//后序线索,这种方法不容易想到 #include<iostream> #include<cstring> #include<cstdio> #include<algorithm> using namespace std; struct TREE{ int