Using the following picture as a model Show your result of e

Using the following picture as a model:

Show your result of each operation for the follolwing sequence:

ENQUEUE (S, 4), ENQUEUE (S, 2), DEQUEUE (), ENQUEUE (S, 3), ENQUEUE (S, 9), DEQUEUE (), and ENQUEUE (S, 0) on an initially empty queue Q stored in array Q[1..6].

Solution

Enqueue(S, 4): tail(S) = 2, head(S) = 1.

Enqueue(S, 2): tail(S) = 3, head(S) = 1.

Dequeue(): tail(S) = 3, head(S) = 2.

Enqueue(S, 3): tail(S) = 4, head(S) = 2.

Enqueue(S, 9): tail(S) = 5, head(S) = 2.

Dequeue(): tail(S) = 5, head(S) = 3.

Enqueue(S, 0): tail(S) = 6, head(S) = 3.

1 2 3 4 5 6
4
Using the following picture as a model: Show your result of each operation for the follolwing sequence: ENQUEUE (S, 4), ENQUEUE (S, 2), DEQUEUE (), ENQUEUE (S,

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site