Question: The MinPQ class was very slow for a big data, in particular "djia.txt" with 19,000+ entries. That's because of the insert function, which did the 'sorted insertion'.

Propose two ways which make the running/practical time faster while guranteering the deleteMin() operation in O(1) time, and explain why/how your choices would work faster than the sorted insertion.

Write three sentences for each alternative way (REQUIRED).
Your explanation has to be as specific as possible.
As a hint, you can say something like "Instead of Java LinkedList for the storage, use XXX instead because YYYYYYYYYY".

• 'Keeping only the top/minimum N elements' is NOT an option for your answer. The MinPQ has to accommodate and keep ALL elements inserted.
• The storage has to be a (physically) linear/one-dimensional structure (such as array, list; including some Java container classes); it cannot be a physically non-linear structure such as tree, table or graph.

Solution PreviewSolution Preview

This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.

1. First solution:
a. We insert all items into an arraylist using add method. This method will put the new item to the end of the arraylist
b. After reading the file, we start to sort the arraylist   using mergesort or quicksort. We will sort the items in descending order....
$83.00 for this solution

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available Data Structures and Algorithms Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Upload a file
Continue without uploading

We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats