Starting from:

$25

create a Priority Queue using a Heap

Heap To do: You will create a Priority Queue using a Heap represented in an array. All was covered in lecture yesterday and one day before last week. Needed: You will need a Heap class that will keep the MAX values as the highest priority that will be removed from the heap first, and the smaller 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 heap. The Heap class will need a method for removing items from the heap. 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 level.......until you get to a level that starts with a null. A Driver class that sends in the ints to be stored in the heap. Implementation, run these steps in order: Add the following items to your heap: 15, 5, 8, 4, 9, 22, 17, 6, 14 Print Heap Remove two items from the heap. Print Heap Add the following 18, 12 Print Heap Remove three items from the heap. Print Heap

More products