Prepare a program that constructs a binary tree

Assignment Help JAVA Programming
Reference no: EM134266

Prepare a program that constructs a binary tree and traverses the tree in pre-order, in-order and post-order methods. Your program must also give the height of the tree. Your program must implement proper object oriented and data structure basic concepts (use interfaces and implement the required primitive operations).

The input must be read from a file. Suppose the nodes store positive numbers and have no duplicates. On every line of input file specify the node, its parent, its left child, and right child. A -1 must be used to show absence of a parent, left child, or right child. Below are some examples of sample input line with explanation:

0 -1 1 2 #Node stores 0 with no parent and has left child and right child that stores values 1 and 2.

1 0 3 4 #Node that stores 0 is parent of 1 and nodes left and right child store 3 and 4.

Here is sample text that must be in your input file

0 -1 1 2
1 0 3 4
2 0 5 6

Write your own implementation of primitive operations and use self-referential classes in your implementation.

Make sure your code runs from command line and specify which version of java was used along with the commands to compile and run your code. Failure to properly document your code will result in penalty.

Also make sure you upload a compressed version of your folder, please use .zip compression format. Your folder must contain only the java source files, please do not include any other kind of files such as jar files, class files, any input text files etc.

Your assignment will be graded based on following structure:

1. Implementation of data structure
2. Implementation of traversal techniques
3. Implementation of finding the height of tree
4. Documentation and indentation

Reference no: EM134266

Questions Cloud

What is the least time necessary for crossing : What is the least time necessary for crossing
What is emf in the secondary circuit : What is EMF in the secondary circuit
What is new angular speed of the merry-go-round : What is new angular speed of the merry-go-round
What is fraction of the diameter of the sun : What is fraction of the diameter of the Sun
Prepare a program that constructs a binary tree : Write your own implementation of primitive operations and use self-referential classes in your implementation.
What is frequency of the rotational motion for the wheel : What is frequency of the rotational motion for the wheel
What is an angular acceleration : What is an angular acceleration
An analysis of the revised project : Evaluate the project in light of this new information
What is modify in frequency ff - fi : What is modify in frequency ff - fi

Reviews

Write a Review

JAVA Programming Questions & Answers

  Build the gui layout of the game

Build the Build the GUI layout of the game in java.

  Evaluate the rtas resource requirements

Design and implement a set of classes and interfaces and use them to evaluate the RTA's resource requirements.

  Implementation activities of software development

Analysis, design, and implementation activities of software development

  Implementation of memory management

Implementation of memory management

  Enterprise java beans (ejb) in software development

Enterprise Java Beans (EJB) in software development, EJB technology, EJB application, Stateless Session Beans (SLSB), Stateful Session Beans (SFSB), Message Driven Bean (MDB), Entity Bean

  Wolves and sheep: design a game

This project is designed a game in java. you choose whether you'd like to write a wolf or a sheep agent. Then, you are assigned to either a "sheep" or a "wolf" team.

  Java program simulate a network

Java program simulate a network

  Implement security so that all users can view the informatio

Implement security so that all users can view the information about the projects, but only authenticated users

  Robot preparing for competition

Create an event so that the skateboard can be controlled by game player

  Write a recursive program

Write a recursive program to compute the number of ways in which an integer k can be written as sum

  Print the contents of the array

Prepare a second loop that prints the contents of the array

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd