Add complete function which creates a binary tree with the given number of nodes.