create a BottomUpTwoThreeFourTree class

  • You will need to create a BottomUpTwoThreeFourTree class, with a BottomUpTwoThreeTreeFourTree constructor which keeps no parameters.
  • BottomUpTwoThreeTreeFourTree will require 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. it is a two key node, the string should be the two values, in increasing order, with a single space between them. Thus, 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 must 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 require 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".

 

 

   Related Questions in Programming Languages

  • Q : What is a Pipe Pipe : It is a linkage

    Pipe: It is a linkage between the two program components. One component responds as a source of data, and writes into the pipe. The second components act as a receiver (that is, sink) for the data and reads from pipe.

  • Q : OCIW32 dll error Normal 0 false false

    Normal 0 false false

  • Q : Explain the way to close an XHTML

    Explain the way to close an XHTML element.

  • Q : Component which are used in 2nd layer

    What are the different types of component parts which are used in 2nd layer?

  • Q : Define Container Abstractions Container

    Container Abstractions: Abstractions for containers (such as lists, stacks, sets, or queues) may represent just the state of a container—e.g., full or empty—and abstract away from the actual container content. The list operations also need

  • Q : Define the term Condition Define the

    Define the term Condition: It is a Boolean expression which controls a conditional statement or loop.

  • Q : Describe Timers Timers: While time

    Timers: While time values usually cannot be reduced in the target system, their usage can be encapsulated as an abstraction which can be replaced easily (e.g., by a non-deterministic choice) during model checking.

  • Q : Define Deep copy Deep copy : It is a

    Deep copy: It is a copy of an object in which copies of all the object's sub-components are also prepared. The resultant object may, in effect, be a clone of the novel.

  • Q : Explain Return type Return type : It is

    Return type: It is the declared type of a method, appearing instantly before the method name, like void in     public static void main(String[] args)    or Point[] in 

  • Q : What is Universal Character Set or UTF

    UTF: Universal Character Set (abbreviated as UCS) Transformation Format. The format for symbolizing multibyte characters which is compatible with programs and file systems which were only made to handle single byte characters.

©TutorsGlobe All rights reserved 2022-2023.