Amazon interview question

Write a binary tree to a file and then restore it.