Java program to create a tree

Assignment Help JAVA Programming
Reference no: EM13463

You will need a BottomUpTwoThreeFourTree class, with a BottomUpTwoThreeTreeFourTree constructor which takes no parameters.
BottomUpTwoThreeTreeFourTree will need an insert(int x) method, which will insert the value x into your tree. For this tree, duplicate insertions should be discarded. That is, if I insert a value into the tree which is already in the tree, do not change your tree. As discussed in class, if a node needs to split, the value passed up to the parent should be the median value of the three keys in the node, before the 4th key is added.
BottomUpTwoThreeFourTree will need a search(int x) method, which will search for the value x in your tree. The method should return a String, formatted as follows. If the value x is in the tree, it will reside in a node with either one, two, or three keys. For a one key node, the string will just be that node's key as a String. If it is a two key node, the string should be the two values, in increasing order, with a single space between them. Finally, three keys should be returned with a single space between each pair, in increasing order. Example: if we are searching for the number 17, and it is a key alone in a node, the search function should return "17". If it is in a node with 35, you should return "17 35". If it is in a node with 10, you should return "10 17". And, if it in a node with keys 10 and 35, you should return "10 17 35". Note, there is no space after the last key value.
If the value searched for is not in the tree, your search should have terminated at a leaf node. In that case, print the contents of that leaf node, with the same formatting described above. That is, if 17 is not in the tree, and you end in a node that contains keys 18 and 20, return "18 20".
You need to submit your own JUnit tests as well, again in a file with a name ending in Test.java or Tests.java. Your main grade will be based on (a) how well your tests cover your own code, (b) how well your code does on your tests, and (c) how well your code does on MY tests. If you fail even one of my tests, I will set up my tests to make sure that you fail many of them. If you know that your code has an error, it is hard to consider your code as "working"

Reference no: EM13463

Questions Cloud

Design style elements in asp : Add drop down lists for modifying the different style elements for the label element that displays the time
Report on american express - marketing strategy : Report on American Express - Marketing Strategy.
Find the integral of a function at an arbitrary location : Write a Matlab function to perform numerical integration of a set of evenly spaced data points using the trapezoidal rule
Women and gender studies : Write an essay on  Women and gender studies.
Java program to create a tree : Java program to create a tree, generate class - BottomUpTwoThreeFourTree, BottomUpTwoThreeFourTree,
Calculate ph - chemistry questions : Chemistry Questions on Calculate P H
An assignment on bot and boot project industries in india : This is an assignment which envelops the critical description over BOT and BOOT project industries in India.
Complexity of cell surfaces : Lipid rafts provide another example of the complexity of cell surfaces in both their structural character and biologic functionality. Please explain the nature of these structures and their functionality.
Biologic function relationships : Please describe how one might search for chemical structure, biologic function relationships, involving small molecular weight lipophylic compounds. Provide one example.

Reviews

Write a Review

 

JAVA Programming Questions & Answers

  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.

  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..

  Java class, array, link list , generic class

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

  Create classes implement java interface

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

  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.

  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.

  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.

  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!.

  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.

  Input pairs of natural numbers

Java program to input pairs of natural numbers.

  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.

  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.

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