Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

JAVA -------------- 1 Requirements 1. Design and implement an AVL Tree Node class that must support nd- Min, insert and remove operations. 2. Design and

JAVA

--------------

1 Requirements

1. Design and implement an AVL Tree Node class that must support "nd-

Min", "insert" and "remove" operations.

2. Design and implement a driver (the main method) that does the following:

(a) Creates an array that contains a list of 5000 integers, in a random

order, from 0 to to 4098.

(b) AVL-insert, into the rst AVL tree that is initially empty, the num-

bers in the array sequentially from the start to the end.

(c) Initialize the second empty AVL tree.

(d) Enter a forever while loop to do the following:

i. Call "ndMin" to nd the node with the smallest value.

ii. Call "Remove" to remove the smallest value from the rst AVL

tree, and display "The process with a priority of %d is now sched-

uled to run!"

iii. For the removed value, change it to a random value between 0

and 4098.

iv. Call "Insert" to insert the removed value (now changed to a

dierent value in the previous step) to the second AVL tree, and

display "The process with a priority of %d has run out of its

timeslice!"

v. When the rst AVL tree becomes empty, display "Every process

has got a chance to run; Please press "Enter" to start the next

round!"

vi. When "Enter" is pressed, swap the two AVL trees, and continue

the loop.

2 Deliverables

1. Design document

2. Source code

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