BinaryTree serialize and deserialize