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

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

Jump to Post

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 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.