Pocket Gems interview question

Data structure and Algorithm questions. A coding question about Tree.