Prepare a program that constructs a binary tree and

Assignment Help JAVA Programming
Reference no: EM13350312

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: EM13350312

Questions Cloud

Questiona hunter wishes to cross a river that is 25 km wide : questiona hunter wishes to cross a river that is 2.5 km wide and that flows with a speed of 4.8 kmh. the hunter uses a
Question1a step-up transformer has 270 turns on its primary : question1a step-up transformer has 270 turns on its primary coil and 90000 turns on its secondary coil. the emf of the
Question1a playground merry-go-round of radius r 180 m has : question1a playground merry-go-round of radius r 1.80 m has a moment of inertia i 255 kg.m2 and is rotating at 8.0
Questionair has a small regularly negligible index of : questionair has a small regularly negligible index of refraction. it is 1.0002926. this causes the sun to actually be
Prepare a program that constructs a binary tree and : prepare a program that constructs a binary tree and traverses the tree in pre-order in-order and post-order methods.
Question1a space station in a form of a large wheel 271m in : question1a space station in a form of a large wheel 271m in diameter rotates to provide an artificial gravity of 2.6
Qestion1a 100-kg beaker containing 209 kg of oil density : question1a 1.00-kg beaker containing 2.09 kg of oil density 916 kgm3 rests on a scale. a 1.99-kg block of iron is
Management has already signed the contract and committed to : management has already signed the contract and committed to a project whichhas a large negative net present value. this
Question1a space station is constructed in the shape of a : question1a space station is constructed in the shape of a wheel 20 in diameter with essentially all of its 5.1times105

Reviews

Write a Review

JAVA Programming Questions & Answers

  Recursive factorial program

Write a class Array that encapsulates an array and provides bounds-checked access. Create a recursive factorial program that prompts the user for an integer N and writes out a series of equations representing the calculation of N!.

  Hunt the wumpus game

Reprot on Hunt the Wumpus Game has Source Code listing, screen captures and UML design here and also, may include Javadoc source here.

  Create a gui interface

Create GUI Interface in java programing with these function: Sort by last name and print all employees info, Sort by job title and print all employees info, Sort by weekly salary and print all employees info, search by job title and print that emp..

  Plot pois on a graph

Write a JAVA program that would get the locations of all the POIs from the file and plot them on a map.

  Write a university grading system in java

University grading system maintains number of tables to store, retrieve and manipulate student marks. Write a JAVA program that would simulate a number of cars.

  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.

  Build a graphical user interface for displaying the image

Build a graphical user interface for displaying the image groups (= cluster) in JMJRST. Design and implement using a Swing interface.

  Determine the day of the week for new year''s day

This assignment contains a java project. Project evaluates the day of the week for New Year's Day.

  Write a java windowed application

Write a Java windowed application to do online quiz on general knowledge and the application also displays the quiz result.

  Input pairs of natural numbers

Java program to input pairs of natural numbers.

  Create classes implement java interface

Interface that contains a generic type. Create two classes that implement this interface.

  Java class, array, link list , generic class

These 14 questions covers java class, Array, link list , generic class.

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