edited by
4,652 views
7 votes
7 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
edited by

1 Answer

9 votes
9 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:

Related questions

9 votes
9 votes
2 answers
1
go_editor asked Jun 17, 2016
4,435 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
34 votes
34 votes
3 answers
2
Kathleen asked Sep 29, 2014
10,944 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
35 votes
35 votes
2 answers
3
Kathleen asked Sep 22, 2014
41,693 views
Increasing the RAM of a computer typically improves performance because:Virtual Memory increasesLarger RAMs are fasterFewer page faults occurFewer segmentation faults occ...
24 votes
24 votes
5 answers
4