Stacks...
Stacks are linear data structure in which items may be added or removed only.
It is more precisely a data structure management technique and it can simply be thought as Last in - first out list
A stack is a list of elements in which an element may be inserted or deleted only at one end.

I on the other hand like to see stacks as simply a stack of pan cakes,
It makes me feel very happy and interested in studies too, so lets discuss it:-
1. Insert:- When you make a pan cake, you put on top of others, so number of pan cakes is increased by one (on the top).
2.Remove:- In case we want a pan cake to eat, we take it right from the top of the pile(stack). So we are left with one less pan cake in the pile and a very happy stomach.
3.View:-If you just want to see how/what you last pan cake was (suppose when you are making different designs on it). You can only see the last pan cake without removing anything.
4.Check for empty:-This way you can see are there any pan cakes left or not.
Now turning towards to the real stack and its some standard terms related to it.
Top of stack:A stack is a list of elements in which an element may be inserted or deleted only at one end, called Top Of Stack.
Push:it is the term used to insert an element into a stack.
Pop: It is the term used to delete an element from a stack.
Peep: it is the term used to see the element on the top the stack without removing it.
rest functions can be seeing if stack is empty or not and searching the stack.
Lets see an example
Here
first is we have a stack.
second is we want to add t in stack.
third is we want to remove t from stack.
forth is the resultant stack.
Now lets see the program and the result :-
Stacks are linear data structure in which items may be added or removed only.
It is more precisely a data structure management technique and it can simply be thought as Last in - first out list
A stack is a list of elements in which an element may be inserted or deleted only at one end.
![]() |
| Stack |

I on the other hand like to see stacks as simply a stack of pan cakes,It makes me feel very happy and interested in studies too, so lets discuss it:-
1. Insert:- When you make a pan cake, you put on top of others, so number of pan cakes is increased by one (on the top).
2.Remove:- In case we want a pan cake to eat, we take it right from the top of the pile(stack). So we are left with one less pan cake in the pile and a very happy stomach.
3.View:-If you just want to see how/what you last pan cake was (suppose when you are making different designs on it). You can only see the last pan cake without removing anything.
4.Check for empty:-This way you can see are there any pan cakes left or not.
Now turning towards to the real stack and its some standard terms related to it.
Top of stack:A stack is a list of elements in which an element may be inserted or deleted only at one end, called Top Of Stack.
Push:it is the term used to insert an element into a stack.
Pop: It is the term used to delete an element from a stack.
Peep: it is the term used to see the element on the top the stack without removing it.
rest functions can be seeing if stack is empty or not and searching the stack.
Lets see an example
Here
first is we have a stack.
second is we want to add t in stack.
third is we want to remove t from stack.
forth is the resultant stack.
Now lets see the program and the result :-
Program
Result




No comments:
Post a Comment