while numberOfNodes > 0:
            node = queue.pop(0)
            nodesSameLevel.append(node)

            if node.getLeftChild():
                queue.append(node.getLeftChild())
            if node.getRightChild():
                queue.append(node.getRightChild())

            numberOfNodes -= 1

        print(printNodesByLevel(nodesSameLevel))


def printNodesByLevel(nodes):
    values = []
    for node in nodes:
        values.append(node.getRootVal())

    return ' '.join('({:d})'.format(x) for x in values)


tree = BinaryTree(1)
tree.insertLeft(2)
tree.insertRight(3)
tree.getLeftChild().insertLeft(4)
tree.getLeftChild().insertRight(5)
tree.getRightChild().insertRight(6)

printEachTreeLevel(tree)
        inorder(tree.getRightChild())


def preorder(tree):
    # print root node first
    if tree:
        print(tree.getRootVal())
        preorder(tree.getLeftChild())
        preorder(tree.getRightChild())


tree = BinaryTree(2)
tree.insertLeft(1)
tree.insertRight(3)
tree.getLeftChild().insertLeft(0)
tree.getLeftChild().insertLeft(7)
tree.getRightChild().insertLeft(9)
tree.getRightChild().insertRight(1)
"""
        2
      /   \
     1     3
    / \   / \
   0   7 9   1

"""
preorder(tree)
print('-------')
inorder(tree)
print('-------')
postorder(tree)