Question: Once the MaxHeap class is prepared, this can be used to implement a PriorityQueue class. A Tester class has also been provided on Blackboard to
Once the MaxHeap class is prepared, this can be used to implement a PriorityQueue
class. A Tester class has also been provided on Blackboard to ensure the MaxHeap and
PriorityQueue classes have been implemented correctly. Refer to the following class diagram to
prepare the PriorityQueue class.
Purpose: To further explore the usecases of binary trees, let's implement a heap. This heap
will ultimately be used to manage a priority queue. A key component of this lab is to recognize
the performance benefits of this design for managing queues based on everchanging priorities
as opposed to more conventional firstinfirstout patterns.
To get started, you will first need to prepare the code to construct and manage the
binary tree as a heap. More precisely, this will be a max heap. A max heap has the following
characteristic: a parent is always larger than its two children. For this assignment, the nodes of
the tree will be simplified to Integer objects rather than Node objects. Refer to the following
class diagram to prepare the MaxHeap class.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
