I have an assignment to write a program in Java to implement the Natural Correspondence Algorithm for converting a linear list into a binary tree. The program should process its inputs in two steps:

(a) It first builds a tree for a given input list

(b) It then traverses the tree using Preorder and Inorder traversal schemes. In each case the program prints out the information field of each node visited during the traversal.

An example of input data would be something like (P (Q R))

How would I go about doing this? Thanks for any help.