首页 > 解决方案 > How is traversal of a finite tree using a deque called?

问题描述

I have a finite tree, with its root node already on a deque. New nodes I always add to the end of the deque. I start traversing the tree by popping from the end of the deque, which is usual for a DFS algorithm. However, always, when I have visited a leaf of the tree, I pop the next node from the front of the deque, as you would do in a BFS algorithm. This means that after I have visited a leaf I will always continue with a node on the lowest (not completely explored) level of the tree (leafs are on higher levels). After visiting this node (and if this node is not a leaf) I switch back to popping from the end of the deque.

Now, let's assume that for the DFS part I do a post-order search (and a level-order for the BFS part); does the resulting search order from my algorithm have a particular well established name?

标签: searchtreedepth-first-searchbreadth-first-searchdeque

解决方案


推荐阅读