Xperi Interview Question

write code for tree traversal and reverse the linked list