Question from data structure... You can use any programming language for giving example
11/16/2019 4:20:15 AM
Consider stack as a pile of books...
Constraints are u can put book on top and remove from top....
1.push means adding book on top.
2.pop means removing book from top
3.peek means to get value ie name of top book
Technical term for stack operation is LIFO ie last in first out data structure
Give it a try... If u have any doubt then ask... How can u ask for complete code.. Only 3-4 functions u need to write and a stack class or structure
Code can be found anywhere on internet.... For array as well as linked list implementation I told u the concept...
Stack is the linear data Structure it is in the form of LIFO means last in first out example of real life is Undo/Redo stacks in Excel or Word...
Maybe this will help,
A stack is like a stack of plates. You can only add (push) and remove (pop) plates from the top. It uses the LIFO principle. That is, Last in first out.
Saurabh B can you explain with some code how can we use?
Saurabh B yes there is but I want simple code which is easy to understand how can we use stack, those are complicated?
GET THE FREE APP
Learn Playing. Play Learning
Send us a message