• edited by
5,311 views
8 8 votes

If the sequence of operations - push (1), push (2), pop, push (1), push (2), pop, pop, pop, push (2), pop are performed on a stack, the sequence of popped out values

  1. 2,2,1,1,2
  2. 2,2,1,2,2
  3. 2,1,2,2,1
  4. 2,1,2,2,2

2 Answers

10 10 votes

Ans A)

Simple push and pop in stack has done here

After pushing some element in stack when we do pop , we get element in LIFO order

Answer:
Position:
Show:

Related questions

11 11 votes
2 answers 2 answers
5.9k
5.9k views
go_editor asked Jun 17, 2016
5,930 views
The queue data structure is to be realized by using stack. The number of stacks needed would beIt cannot be implemented2 stacks4 stacks1 stack
7 7 votes
2 answers 2 answers
5.7k
5.7k views
go_editor asked Jun 19, 2016
5,688 views
Consider the following program.main() { fork(); fork(); fork(); }How many new processes will be created?8675
15 15 votes
11 answers 11 answers
29.6k
29.6k views
ajit asked Oct 12, 2015
29,583 views
Semaphores are used to solve the problem ofRace ConditionProcess SynchronizationMutual ExclusionNone of the aboveI and IIII and IIIAll of the aboveNone of the above
49 49 votes
4 answers 4 answers
17.6k
17.6k views
Kathleen asked Sep 29, 2014
17,616 views
Dirty bit for a page in a page tablehelps avoid unnecessary writes on a paging devicehelps maintain LRU informationallows only read on a pageNone of the above