Monday, January 29, 2018

Stack Abstract Data Type Data Structure

Stack ADT, Stack data structure, basic operations performed on stack, stack operation in data structure, push and pop operation in data structure, stack data structure with example


Stack ADT


  • Stack is a special kind of list in which all insertions and deletions occur at one end, called the top.
  • Stack ADT is a special case of the List ADT. It is also called as a LIFO list or a pushdown list.
  • In stack, the element which goes into the stack at last is the one which is coming/extracted out. Hence, it is called LIFO (Last In First Out) list.
Typical Stack ADT Operations:
  1. createStack (S) - creates an empty stack.
  2. top (S) - returns the element at the top of the stack.
  3. pop (S) - deletes the top element of the stack.
  4. push (x, S) - Inserts element x at the top of stack S.
  5. empty (S) - returns true if S is empty and false otherwise
  • Stack is a natural data structure to implement subroutine or procedure calls and recursion in many compilers.
Stack Implementation: Stacks can be implemented using Arrays or Pointers.

Example - Stack operations :
PUSH operation:
Inserts an element into the stack from top only.

POP operation:
Removes an element from the stack through top only.



**********






Featured Content

Multiple choice questions in Natural Language Processing Home

MCQ in Natural Language Processing, Quiz questions with answers in NLP, Top interview questions in NLP with answers Multiple Choice Que...

All time most popular contents

data recovery