binaryTree Train Apply function compeleted and tested