The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | May 2017 |
| Last Sign in: | 398 Weeks Ago, 6 Days Ago |
| Questions Answered: | 66690 |
| Tutorials Posted: | 66688 |
MCS,PHD
Argosy University/ Phoniex University/
Nov-2005 - Oct-2011
Professor
Phoniex University
Oct-2001 - Nov-2016
1. A priority queue is implemented as a sequential array-based list. The highest-priority item is in the first array position, the second-highest priority item is in the second array position, and so on.
a. Write the declarations in the private part of the priority queue class definition needed for this implementation.
b. Write the Enqueue operation, using this implementation.
c. Write the Dequeue operation, using this implementation.
d. Compare the Enqueue and Dequeue operations to those for the heap implementation, in terms of Big-O notation. Under what conditions would this implementation be better or worse than the heap implementation?
2. A stack is implemented using a priority queue. Each element is time-stamped as it is put into the stack. (The time stamp is a number between 0 and INT_MAX. Each time an element is pushed onto the stack, it is assigned the next larger number.)
a. What is the highest-priority element?
b. Write the Push and Pop algorithms, using the specifications in Chapter 4.
c. Compare these Push and Pop operations to the ones implemented in Chapter 4, in terms of Big-O notation.
3. A FIFO queue is implemented using a priority queue. Each element is times tamped as it is put into the queue. (The time stamp is a number between 0 and INT_MAX. Each time an element is enqueued, it is assigned the next larger number.)
a. What is the highest-priority element?
b. Write the Enqueue and Dequeue operations, using the specifications in Chapter 4.
c. Compare these Enqueue and Dequeue operations to the ones implemented in Chapter 4, in terms of Big-O notation.
Hel-----------lo -----------Sir-----------/Ma-----------dam-----------Tha-----------nk -----------You----------- fo-----------r u-----------sin-----------g o-----------ur -----------web-----------sit-----------e a-----------nd -----------and----------- ac-----------qui-----------sit-----------ion----------- of----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n.P-----------lea-----------se -----------pin-----------g m-----------e o-----------n c-----------hat----------- I -----------am -----------onl-----------ine----------- or----------- in-----------box----------- me----------- a -----------mes-----------sag-----------e I----------- wi-----------ll