Saturday, 27 August 2011

Stacks






Definition
The abstract Data Type
Array Representation
Linked List Representation or Stacks using Linked List

Stack applications

Definition of Stack:

A Stack  is a basic data structure it can be defined as abstract which is used to store the data where Insertion and deletion are performed from only one end that is top-end so Stack is called as LIFO (Last In First Out). That is last inserted value is first deleted.
Example, in parking area last parked bike is removed first, and first parked bike is removed last.
Insertion is called push, deletion is called pop.
Stack is ordered list of elements of same type.
Stack is Linear List
All the operations insertion, deletion are performed from one end.

Where do we use?
a) Processing of procedure calls and their termination. 
b) In a recursive call of a function.


Stack using c Stacks using Linked List


Data Structures through c++

No comments:

Post a Comment