You are viewing a single comment's thread. Return to all comments →
Python solution:
import sys def levelOrder(root): if root is None: return q = [root] while(len(q) > 0): sys.stdout.write(str(q[0].data) + ' ') n = q.pop(0) if not n.left is None: q.append(n.left) if not n.right is None: q.append(n.right)
Seems like cookies are disabled on this browser, please enable them to open this website
Tree: Level Order Traversal
You are viewing a single comment's thread. Return to all comments →
Python solution: