You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For three different kinds of traversal, we only need to change the order of tuples in one line just like what we've done in the recursive solution which is very decent and classical. Just put (0, p[1]) in different order!
The idea is from my former lab-mate and it's actually a BFS but changing the order on queue when traversing to emulate DFS.
For three different kinds of traversal, we only need to change the order of tuples in one line just like what we've done in the recursive solution which is very decent and classical. Just put (0, p[1]) in different order!
The idea is from my former lab-mate and it's actually a BFS but changing the order on queue when traversing to emulate DFS.
For post-order traversal:
For in-order traversal:
For pre-order traversal:
The text was updated successfully, but these errors were encountered: