Q. Show the status of queue after each operation


enqueue(34)

enqueue(54)

dequeue()

enqueue(12)

dequeue()

enqueue(61)

peek()

dequeue()

dequeue()

dequeue()

dequeue()

enqueue(1)


Answer =

queue = [  ]

enqueue(34)
queue = [ 34 ]

enqueue(54)
queue = [ 34 , 54 ]

dequeue()
queue = [ 54 ]

enqueue(12)
queue = [ 54 , 12 ]

dequeue()
queue = [ 12 ]

enqueue(61)
queue = [ 12 , 61 ]

peek()
12

dequeue()
queue = [ 61 ]

dequeue()
queue = [ ]

dequeue()
Under Flow

dequeue()
Under Flow

enqueue(1)
queue = [ 1 ]


3 Comments

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post