Stack a Data Structure


Published on

Published in: Education, Technology
1 Like
  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Stack a Data Structure

  1. 1. Department of ITPresented by- Narendra katariya
  2. 2. The stack is a very common and non primitive data structure used inprograms. By data structure, I meansomething that is meant to hold data and provides certain operations on that data.
  3. 3. Abstract definition• A stack is a fundamental computer science data structure and can be defined in an abstract, implementation-free manner,• it can be generally defined as, Stack is a linear list of items in which all additions and deletion are restricted to one end that is Top.
  4. 4. Examples of stack
  5. 5. Operations on stack• a stack is a last in, first out (LIFO) abstract data type and Data structure In computer science, a data structure is a particular way of storing and organizing data in a computer so that it can be used efficiently .Different kinds of data structures are suited to different kinds of applications, and some are highly specialized to specific tasks... A stack can have any abstract data type as an element, but is characterized by only three fundamental operations: push, pop and stack top
  6. 6. The basic operations that can be performed on stack:• Push: The process of adding a new element of top of the stack is called push operation. Pushing an element In the stack invoke adding of element, as the new element will be inserted at the top after every push operation the top is incremented by one. In case the array is full and no new element can be accommodated ,it is called stack full condition . This condition is called stack overflow.
  7. 7. Pop: the process of deleting an element from the Top of the stack is called pop operation. After every pop operation the stack is decrement by one. If there is no element on the stack and the pop is performed then this will result into stack underflow condition.
  8. 8. • A common model of a stack is plates in a marriage party or coin stacker. Fresh plate are “pushed” onto to the top and “popped ” from the top.
  9. 9. Stack implementation Stacks static array dynamic arrays Graphical regionParenthesis fillchecker
  10. 10. Stack implementation in two way:• Static implementation: these implementation uses arrays to create stack. Static implementation though a very simple technique but is not a flexible way of creation as the size of stack has to be declared during program design after that can not be varied. Static implementation is not too efficient with respect to memory utilization.• Dynamic implementation: these implementation is also called link list implementation and uses pointer to implement the stack type of data structure.
  11. 11. Stack Applications• A Palindrome is a string that reads the same in either direction – Examples: “Able was I ere I saw Elba”• Reversing the string• Implementation of DFS - a stack is the proper data structure to remember the current node and how to backtrack.
  12. 12. Calculation of arithmetic notation• Infix notation: the infix notetion is what we come across our general mathematics, where the opereter is written in between the operand.Example: A+B• prefix notation: the prefix notation a notation in which the operators is written before the operand, it is also called polish notation.Example: +AB• Postfix notation: in the postfix notation the operators are written after the operands, so it’s called the postfix notation’ it’s also called suffix notation.Example :AB+
  13. 13. Thank you