build and print the binary tree, including loop and recursion