Stack ADT - Introduction and Implementation

A stack is a data structure and generally called as stack ADT (abstract data type). Stack can be implemented using arrays or linked lists. Read this article for an introduction of stack and C programs to implement stack using arrays and linked lists.

Introduction to Stack

A Stack is a data structure which follows FILO (first in last out) principle. The element which is entered first into the stack (first in) is the element which can be last deleted from the stack (last out). Two operations PUSH and POP are commonly used for stack. Here, PUSH means insertion and POP means deletion. Operations like insertion, deletion can be performed at only one end of a stack. A pointer called TOP is used for stacks. Here, TOP represents the end at which insertion and deletion can be performed. There are some other operations for stacks which are PEEK, ISFULL and ISEMPTY. Here, PEEK is used to get the first element of the stack without removing it and ISFULL, ISEMPTY are used to check whether the stack is full (over flow error) or empty (under flow error) respectively. Let us take some real life examples. We put dinner plates to wash one on one and we put playing cards one on one etc,. In the both cases, what gets first into the line (stack) gets out last from the line (stack) i.e. FILO principle. The image below shows a stack, its operations (only insertion and deletion but not others) and the TOP pointer.

Subscribe to Email

About IndiaStudyChannel.com

Being the most popular educational website in India, we believe in providing quality content to our readers. If you have any questions or concerns regarding any content published here, feel free to contact us using the Contact link below.