摘要:
以非递归先根遍历为例。先把所有的可能的状态列出来,同时把此状态下对应的处理写出来:表1LeftChildRightChildPreOrderExistVisitedExistVisitedYNYN//1cout<<cur<<','; prev = cur; cur = cur->Left; s.push(cur);YNNNYYYN//2prev = cur; cur = cur->Right; s.push(cur);YYNN//3s.pop(); prev = cur; cur = s.top();YYYY//3s.pop(); prev 阅读全文