The Gateway to Computer Science Excellence
+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
in DS by Veteran (105k points) | 3.6k views

1 Answer

+8 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

by Veteran (119k points)

Related questions

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
50,737 questions
57,297 answers
104,977 users