Day 23: BST Level-Order Traversal

  • + 0 comments
    Python3
    
        def levelOrder(self,root):
        #Write your code here
        if root is None:
            return
        queue = [root]
        while queue:
            node = queue.pop(0)
            print(node.data, end=" ")
            if node.left:
                queue.append(node.left)
            if node.right:
                queue.append(node.right)