1 CSc 130 Assignment 3 Simulation of A Simple CPU Scheduler Using Binary Heap Dr. Jinsong Ouyang 1 Requirements 1. Design and implement a Binary Heap class that must support ”insert” and ”deleteMin”...

1 answer below »
See File


1 CSc 130 Assignment 3 Simulation of A Simple CPU Scheduler Using Binary Heap Dr. Jinsong Ouyang 1 Requirements 1. Design and implement a Binary Heap class that must support ”insert” and ”deleteMin” 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 from 0 to 4999 sequentially. (b) Randomly shuffle the array so that the values in the array are not in order. (c) Insert, into the first binary heap that is initially empty, the numbers in the array sequentially from the start to the end. (d) Initialize the second empty binary heap. (e) Enter a forever while loop to do the following: i. Collect the first timestamp. ii. Call ”deleteMin” to remove the smallest value from the first heap, and display ”The process with a priority of %d is now scheduled to run!” iii. For the deleted value by the ith “deleteMin”, change it to the value in the ith item of the shuffled array. iv. Call ”Insert” to insert the deleted value (now changed to a different value in the previous step) to the second heap, and display ”The process with a priority of %d has run out of its timeslice!” v. When the first heap becomes empty, collect the second times- tamp, compute the ∆ of the two timestamps, and display ”It took ∆ msecs for all processes to run out of their timeslices.”; Please press ”Enter” to start the next round!” vi. When ”Enter” is pressed, swap the two heaps, and continue the loop. 2 Table 1: Performance Measurement Round 1 Round 2 Round 3 Round 4 Round 5 Average AVL Heap 2 Deliverables 1. Source code 2. Performance evaluation. Run your program a number of times and record the running time for each round. Then go back to change your 2nd program (if necessary) to collect the same running time information. Represent in a table the performance results by the two solutions, then compare the differences and explain possible causes to the difference in running time. CSc 130 Assignment 3 1 Requirements 2 Deliverables
Answered 2 days AfterApr 21, 2021

Answer To: 1 CSc 130 Assignment 3 Simulation of A Simple CPU Scheduler Using Binary Heap Dr. Jinsong Ouyang 1...

Pulkit answered on Apr 24 2021
151 Votes
81538_java/BinaryHeapTest.class
public synchronized class BinaryHeapTest {
public void BinaryH
eapTest();
static void randomize(int[], int);
public static void...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here