Xperi interview question

write code for tree traversal and reverse the linked list