add post-order traversal picture to chp5.md.
This commit is contained in:
@@ -270,6 +270,10 @@ void BinNode<T>::inOrder_It2(VST &visit) {
|
||||
+ 当前结点是左结点。则弹栈的结点是当前结点的右结点。对右结点的处理应该继续迭代地访问右结点的最高左侧可见结点。
|
||||
+ 当前结点是右结点。则弹栈的结点是当前结点的父结点。此时应该访问当前结点,然后直接进入下一步的迭代,再次进行弹栈操作。
|
||||
|
||||
后续遍历的访问过程如下图所示:
|
||||
|
||||
![后续遍历的访问过程]()
|
||||
|
||||
综上所述,后序遍历的非递归算法如下:
|
||||
|
||||
```cpp
|
||||
|
||||
BIN
thu_dsa/chp5/images/postOrder.png
Normal file
BIN
thu_dsa/chp5/images/postOrder.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 204 KiB |
Reference in New Issue
Block a user