Stack

What is Stack?
Stack is a particular kind of abstract data type or collection of data. In Stack the principal operations are push and pop. In stack we push data from end and pop from end. Stack can be implements using linked list or array. Example of stack is books in library one over another, Plates in kitchen etc.
Stack (source wikimedia)

                           The relation between the push and pop operations is such that the stack is a Last in First Out, means the fresh element remove from stack first.
                            Stack is also a kind of list on which we perform push and pop operation.

Applications : -

  • Backtracking.
  • Run-time memory management.
Stack Over Flow Problem : -
                     Stack Over Flow problem exists when whole stack memory is full. Means there is no free place to push data in memory or stack.

Stack Under Flow Problem : -
                      Stack Under Flow problem exists when there is no data exist in stack. Means there is no data to perform pop operation. Here Position of top pointer and bottom pointer is same.

Click here for programs.

Popular posts from this blog

Shutdown Pc

Ellipse using OpenGl

String Comparisons