1.) Describe the out put for the following sequence of queueoperations: enqueue
ID: 3609500 • Letter: 1
Question
1.) Describe the out put for the following sequence of queueoperations: enqueue (5), enqueue (3), .dequeue ( ), enqueue (2), enqueue(8), dequeue( ), dequeue( ), enqueue(9), enqueue(1), dequeue( ),enqueue( 7), enqueue(6), dequeue ( ), dequeue( ), enqueue(4),dequeue( ), dequeue( ). Please send the solution asp. Thank you 1.) Describe the out put for the following sequence of queueoperations: enqueue (5), enqueue (3), .dequeue ( ), enqueue (2), enqueue(8), dequeue( ), dequeue( ), enqueue(9), enqueue(1), dequeue( ),enqueue( 7), enqueue(6), dequeue ( ), dequeue( ), enqueue(4),dequeue( ), dequeue( ). Please send the solution asp. Thank youExplanation / Answer
A queue is a first in first out (FIFO) structure . Like atrain going through a tunnel the first car into the tunnel is thefirst car out of the tunnel, the last car into the tunnel is thelast car out of if. Or a line at the bank. as you get to the front of theline you are taken care of. so enqueue 5 means 5 get on line then enqueue 3 means 3 gets on line behind 5 the we dequeue, so the person (5) at the front of the line isoutput so only 3 is left on the line, at the fron of it enqueue 2 - 2 gets on line behind 3 enqueue 8 - 8 gets on line behind 2. so we now have 3 atthe front followed by 2 and then 8 dequeue - the one at the front of the line is removed, so 3 isremoved leaving 2 and 8 this continues until no more instructions. Hope this helps!!Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.