BinaryTree function

Builds a binary tree.