Ask Question

Suppose an initially-empty queue Q has performed a total of 32 enqueue operations, 10 front operations, and 15 dequeue operations, 5of which generated EmptyQueueExceptions, which were caught and ignored. What is the current size of Q?

+5
Answers (1)
  1. 13 May, 22:35
    0
    22

    Explanation:

    1. We are going to have at hand 32 Enqueue Operation, with 10 from front and 15 dequeue and 5 empty queue operation

    2. You dequeued total number of 15-5 = 10 elements since 5 dequeue did not change the state of the queue, so invariably 10 dequeue is done.

    3. Next is to enqueued a total of 32 elements.

    Enqueue Operation do not change the state (and Size) of the queue, and can be ignored.

    4. To arrive at the Total Size of queue, we will have 32-10 = 22 at the end

    Answer : 22 because its a 5 dequeue Operations.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “Suppose an initially-empty queue Q has performed a total of 32 enqueue operations, 10 front operations, and 15 dequeue operations, 5of ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers