Question
Print a binary tree layer-by-layer from top to bottom, and from left to right for each layer.
Solution
Yes, it’s a simple task. We can use breadth-first search, and which means we need a queue.
Example
# node structure
class bst_node:
def __init__(self, value, left=None, right=