|
I think about it this way:
Queue-based breadth-first traversal is used. Each time a visited node is popped from the queue into the stack, the data item at the top of the stack after the traversal is requested.
The complexity of this algorithm is indeed much greater than that of array-based ones. |
|