1.

Consider the following operation along with Enqueue and Dequeue operations on queue where k is a global parameter.Multi - Dequeue (Q){ m = k ; while ((Q is not empty) and (m > 0)) { Dequeue (Q); m = m - 1 ; }}What is the worst case time complexity of a sequence of n queue operations on an initially empty queue?

Answer»

Consider the following operation along with Enqueue and Dequeue operations on queue where k is a global parameter.



Multi - Dequeue (Q)

{

m = k ;

while ((Q is not empty) and (m > 0))

{

Dequeue (Q);

m = m - 1 ;

}

}



What is the worst case time complexity of a sequence of n queue operations on an initially empty queue?



Discussion

No Comment Found