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.

Recommended Answers

All 4 Replies

Find a definition for the algorithm you are supposed to use and study it.

I can't find anything on it.

That will make it much harder.

True. Thanks for the help.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.