Introduction to Stack |
Data Structures Tutorials
The introduction to stack is the introduction introductory part of stack
some basic operations on stack what what are the meaning of those
operations. The next video will show how logically you are going to
represent a stack. The rule on which this stack data structure works is
what leave for last in first out or you can say first in last out this CD
was first in. If you want to remove a plate then first plate you will
take out first. Then you will put on this plate then third and fourth and
fifth like this you are going to place. Push second operation is pop
operation. Pop means always the topmost element would be popped out from
the step right so no need to pass anything in this function. Fourth
operation may be is empty means it will true if the stack is empty there
is known data in the list just in the stack. Another may be full so this
function will return true if this stack is full otherwise it will return
false.
Using by static memory location or dynamic memory allocation right that
thing in detail we will discuss in next video see suppose the capacity is
here 5 so you can insert here 5 elements only fine at starting at
starting top is what top is equal to minus 1 fine 5 means you can say you
can. insert 5 elements the index would be 0 first of all then 1 then 2
then 3 then 4 from 0 to 4 right. stack is used to reverse a string or in
reverse a word then we will use stack that is very simple. The most basic
application is for undo mechanism in text editor. Recursion means it is a
chain or function call a function is calling itself again and again right
so whenever that function would return something then that values would
be stored in stack. This is just an introductory video of this tag to get
you familiar with stack the logical representation of star. stack data
structure is used you can say in topological sorting in DFS we are using
staff in Tower of Hanoi problem also we are going to use staff in tray
traverser also we will use step right.