Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In JAVA I am using Data Structure and algoritms in Java Second Edition Program Must Compile and run! This project should be easy. Write a

In JAVA

I am using Data Structure and algoritms in Java Second Edition

Program Must Compile and run!

This project should be easy. Write a program that returns the minimum value in a 2-3-4 tree.

In text please

MUST COMPILE AND RUN ,PLEASE DISPLAY OUTPUT With Comments. IN TEXT

Include Main method below in program

public static void main(String[] args) throws IOException

{

long value;

Tree234 theTree = new Tree234();

theTree.insert(50);

theTree.insert(40);

theTree.insert(60);

theTree.insert(30);

theTree.insert(70);

while(true)

{

System.out.print("Enter first letter of ");

System.out.print("show, insert, find, or minimum: ");

char choice = getChar();

switch(choice)

{

case 's':

theTree.displayTree();

break;

case 'i':

System.out.print("Enter value to insert: ");

value = getInt();

theTree.insert(value);

break;

case 'f':

System.out.print("Enter value to find: ");

value = getInt();

int found = theTree.find(value);

if(found != -1)

System.out.println("Found "+value);

else

System.out.println("Could not find "+ value);

break;

case 'm':

value = theTree.getMin();

System.out.println("Minimum value is " + value);

break;

default:

System.out.print("Invalid entry ");

} // end switch

} // end while

} // end main()

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions