Apple interview question

Tree Implementation