Question: Implement the pseudo algorithm of Priority Queue using an array in Python (programming language you are familiar with). 1. You will randomly generate 100 integers

Implement the pseudo algorithm of Priority Queue using an array in Python (programming language you are familiar with).

1. You will randomly generate 100 integers between 0 and 500 and organize the array to build a max heap. Each generated number acts as a key (priority) in the heap.

2. Display the numbers in the array (this represents a max heap for the priority queue).

3. Test the priority queue by extracting a max number (key) from the heap.

4. Display the numbers in the array again (this time the max number was removed from the heap and the remaining 99 numbers will be displayed in a reorganized max heap).

5. Increase the key of the 50th element and Display the numbers in the array

6. Your implementation should follow the pseudocode provided in the textbook/lecture and use your variables in the implementation. Each must be a separate method.

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!