15 层次遍历

优质
小牛编辑
128浏览
2023-12-01

def lookup(root):
  row = [root]
  while row:
    print(row)
    row = [kid for item in row for kid in (item.left, item.right) if kid]