Amazon Interview Question

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