Added algorithm that writes BST to file.