Queue & Stack Question

I have a question I need some explaination please:

Suppose we perform an intermixed sequence of insert and remove operations to an ADT such that the integers 1 to 0 are inserted as follows:

1 is inserted before 2, 2 is inserted before 3, 3 is inserted before 4, and so on.

For each sequence shown below, write down the first impossible integer removed from the sequence, or 0 if no such impossible remove operation exists, assuming the ADT is
i) A stack
ii) A queue

B. 2,3,4,5,6,7,0,9,8,1

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!