Have the createTree() function worked out roughly