Question: Java To do: You will create a Priority Queue using a Heap represented in an array. All was covered in lecture last Mondaydo not use

 Java To do: You will create a Priority Queue using a

Java

To do: You will create a Priority Queue using a Heap represented in an array. All was covered in lecture last Mondaydo not use the Java API for this, implement it yourself just like I did in class. Needed: You will need a Heap class that will keep the MININUM values as the highest priority that will be removed from the heap first, and the larger numbers with less priority The Heap class will need an instance field array that holds ints, you can just make the array size 25 and we'll make sure we don't go over 25 elements. . The heap class will need a method for inserting items in the heajp The Heap class will need a method for removing items from the heap o Both methods will need to handle rearranging the items in the heap The Heap class will need a method for printing out the heap level by leve..until you get to a level that starts with a null. See if you can format it to look like a tree shape, the top will need to be centered (the pretty tree isn't a requirement) (Do this last) . A Driver class that sends in the ints to be stored in the heap Implementation, run these steps in order 1. Add the following items to your heap: 12, 45, 21, 5, 21, 10, 3, 55, 15 2. Print Heap (loop that prints the arrray, in order of Array) 3. Remove two items from the heap 4. Print Heap 5. Add the following 32, 6 6. Print Heap 7. Remove three items from the heap 8. Print Heap

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!