Question: Answer in Java with output please :) ASSIGNMENT #5-MORE TREES Write a complete program, using the node representation of binary trees (the nodes can be

 Answer in Java with output please :) ASSIGNMENT #5-MORE TREES Write

a complete program, using the node representation of binary trees (the nodesAnswer in Java with output please :)

ASSIGNMENT #5-MORE TREES Write a complete program, using the node representation of binary trees (the nodes can be The program will read in a set of data representing a family tree. It will implement this as a binary Here is an outline of what the program will do: First, it will do whatever initializations (f any) are necessary Then it will read in a set of data representing a family tree. The format of the data is described implemented using either an array or dynamic storage, your choice) to do the following... tree in Pascal, then it will answer a series of questions about the family tree. below. You should print the original data as it is read in. By hand, you should draw the original family tree in it's usual form. The program will convert the data into a binary tree (this can be done as you are reading the data in). By hand you should draw the binary tree representing the original tree Next the program will answer a series of questions about the tree. Possible questions are: Given a person p in the tree 1) Who is the father of p? 2) Who are all the sons of p? 3) Who are all the brothers of p? 4) Who is the oldest brother of p? 5) Who is the youngest brother of p? 6) Who is the oldest son of p? 7) Who is the youngest son of p? 8) Who are the uncles of p? 9) Who is the grandfather of p? Note: P can be any node in the tree, including the root or a leaf. the first thing to do is locate p in the tree (you might want to store some information along the way down to p). You should determine what the question is, then answer each question in a separate subprogram. (Of course, that subprogram may all other subprograms as well. Some of these may be shared.) Note that the same question can be asked several times for a given tree, each time for a different node p. After you have answered a series of questions about this tree, you should start the process all over again for a different family tree. Start the output from each tree on a new page. Continue this for at least 5 family trees, including those given in class. Your program should be written in a modular style. Be sure that each subprogram has a very good comment explaining what it does. Be sure to specity any global variables that you might use. ASSIGNMENT #5-MORE TREES Write a complete program, using the node representation of binary trees (the nodes can be The program will read in a set of data representing a family tree. It will implement this as a binary Here is an outline of what the program will do: First, it will do whatever initializations (f any) are necessary Then it will read in a set of data representing a family tree. The format of the data is described implemented using either an array or dynamic storage, your choice) to do the following... tree in Pascal, then it will answer a series of questions about the family tree. below. You should print the original data as it is read in. By hand, you should draw the original family tree in it's usual form. The program will convert the data into a binary tree (this can be done as you are reading the data in). By hand you should draw the binary tree representing the original tree Next the program will answer a series of questions about the tree. Possible questions are: Given a person p in the tree 1) Who is the father of p? 2) Who are all the sons of p? 3) Who are all the brothers of p? 4) Who is the oldest brother of p? 5) Who is the youngest brother of p? 6) Who is the oldest son of p? 7) Who is the youngest son of p? 8) Who are the uncles of p? 9) Who is the grandfather of p? Note: P can be any node in the tree, including the root or a leaf. the first thing to do is locate p in the tree (you might want to store some information along the way down to p). You should determine what the question is, then answer each question in a separate subprogram. (Of course, that subprogram may all other subprograms as well. Some of these may be shared.) Note that the same question can be asked several times for a given tree, each time for a different node p. After you have answered a series of questions about this tree, you should start the process all over again for a different family tree. Start the output from each tree on a new page. Continue this for at least 5 family trees, including those given in class. Your program should be written in a modular style. Be sure that each subprogram has a very good comment explaining what it does. Be sure to specity any global variables that you might use

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!