Price Queue Class Assignment | Homework For You |

  • by

Price Queue Class Assignment | Homework For You |

5. The Price Queue class is identical to the Queue class from the book’s website with the following modifications:
• Instead of it being a generic queue, the queue only contains Price objects.
• The prices in the queue are unique. If a price that is already in the queue is enqueued again, an IllegalArgumentException is thrown.
• There is an additional unimplemented method called delete that takes a Price argument.
6. You must implement the delete method. Below are the requirements:
• The delete method takes a Price as an argument and removes the price from the queue if it is present. (If the Price was not present, the method does nothing). The method returns true if the Price was deleted and false otherwise.
• The method must run in logarithmic time. This is a key requirement. Solutions that are linear or worse will lose 60 points!
• You may not modify the function headers of any of the functions already present.
• The only field you may add to the PriceQueue class is a single TreeMap. (See Java’s API for the TreeMap class. It is basically the same as the book’s RedBlackBST class)
You may not change or remove the package declaration at the top of the files. The rest of the queue should continue to behave as expected. In particular, the remaining Prices should still come out of the queue in FIFO order. The enqueue and dequeue methods should also run in logarithmic time while the size, peek, and isEmpty methods continue to run in constant time.
Note, the enqueue method given to you runs in linear time because it scans the list to see if the price being added is already in the queue. You will need to replace this with a different way of checking that doesn’t take linear time. (Hint: Use the map!) You will need to make changes to the Price class as well, but you can only add new functionality. You may not make any changes to the functions that are already there and they must continue to behave as before. Get Finance homework help today
TOP ACADEMIC WRITER
He has decades of experience in the education field and has served in the examination boards of some of the top Universities within & outside the United States America.

Related

Price Queue Class Assignment | Homework For You |

 

Homework Nerds have been helping students since 2006. Contact us today, and let us take care of all your academic needs. At Homework Nerds, we can take care of your academic needs. We can write your papers, do your presentations, learning team assignments, Labs, discussion questions and final exams. We also offer an entire week and entire class plans where we login to your classroom and take care of all class activities for you.

Homework Nerds: The #1 Most trusted academic services website.

CLICK HERE TO ORDER NOW – ORIGINAL CONTENT FROM SCRATCH 

OR 

.

 

Price Queue Class Assignment | Homework For You |

5. The Price Queue class is identical to the Queue class from the book’s website with the following modifications:
• Instead of it being a generic queue, the queue only contains Price objects.
• The prices in the queue are unique. If a price that is already in the queue is enqueued again, an IllegalArgumentException is thrown.
• There is an additional unimplemented method called delete that takes a Price argument.
6. You must implement the delete method. Below are the requirements:
• The delete method takes a Price as an argument and removes the price from the queue if it is present. (If the Price was not present, the method does nothing). The method returns true if the Price was deleted and false otherwise.
• The method must run in logarithmic time. This is a key requirement. Solutions that are linear or worse will lose 60 points!
• You may not modify the function headers of any of the functions already present.
• The only field you may add to the PriceQueue class is a single TreeMap. (See Java’s API for the TreeMap class. It is basically the same as the book’s RedBlackBST class)
You may not change or remove the package declaration at the top of the files. The rest of the queue should continue to behave as expected. In particular, the remaining Prices should still come out of the queue in FIFO order. The enqueue and dequeue methods should also run in logarithmic time while the size, peek, and isEmpty methods continue to run in constant time.
Note, the enqueue method given to you runs in linear time because it scans the list to see if the price being added is already in the queue. You will need to replace this with a different way of checking that doesn’t take linear time. (Hint: Use the map!) You will need to make changes to the Price class as well, but you can only add new functionality. You may not make any changes to the functions that are already there and they must continue to behave as before. Get Finance homework help today
TOP ACADEMIC WRITER
He has decades of experience in the education field and has served in the examination boards of some of the top Universities within & outside the United States America.

Related

Price Queue Class Assignment | Homework For You |