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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started