Computer Science, asked by nanditas, 4 months ago

If the following sequence of operations are performed on a stack, the sequence of popped out value will be ?Push(7), Push(8), Pop, Push(7),Push(8), Pop, Pop, Pop, Push(7), Pop. *​

Answers

Answered by laxmishubh007LA
0

ANSWER

The following sequence of the operations is performed on a stack PUSH(10), PUSH(20), POP, PUSH(10), PUSH(20), POP, POP, POP, PUSH(20), POP the sequence of values popped out is 20,20,10,10,20.

 

Stack is collection of elements, that follows the LIFO order. LIFO stands for last In first out, which means element which is inserted most recently will be removed first.

 

A stack has a restriction that insertion and deletion of element can only be done from only one end of stack and we call that position as top. The element at top position is called top element. Insertion of element is called push and deletion is called pop.

Similar questions