Stack Implementation
It works on first in last Out.
Youtube Video to understand Stack
Variables
top =0;
add to stack(push)
//boundary value:- if stack has a limit;
if(top<limit){
top ++;
add value to top
}else{
stack full
}
remove (pop)
if(top !=0){
take value from top
top–
}else{
stack Empty
}
Traversal
in order of first in
for (i = 1;i<=top;i++){
print element at i
}
WikiPedia Link , refer for stack theory.
http://en.wikipedia.org/wiki/Stack_(abstract_data_type)