Question
Implementing a Priority Queue 1. Background Our goal will be to implement a Priority Queue. Specifically, a min heap. Although heaps may seem pretty straightforward,
Implementing a Priority Queue 1. Background Our goal will be to implement a Priority Queue. Specifically, a min heap. Although heaps may seem pretty straightforward, they can be used in abstract ways to solve difficult problems. Additionally, they are of utmost importance when dealing with greedy algorithms, like Dijktras shortest path algorithm that are in the cornerstone of modern technology (think Google Maps). Today we are going to solve a more straightforward question dealing with matrix and the p-smallest values within it. 2. Requirements For this assignment, you will implement the provided priority queue interface (see PriorityQueue.java).
This interface file does not only define which methods you must implement, but gives you documentation that describes how they should work. Creating the ADT will involve creating x methods: public interface PriorityQueue 1. Your job is to find the 30th 920th and 2430th value, which we will call the P values. a. Note, 7 is 5th smallest, 8 is 6th smallest, 9 is 7th smallest, etc. 2. You must use your priority queue to solve this question. Additionally, you must adhere to the following contains: a. Time complexity will be at most O(P + P(log(P)) b. Space complexity will be O(P)
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