Ask Question
15 February, 22:22

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?

+2
Answers (1)
  1. 16 February, 00:16
    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?
Get 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 there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers