What is a stack?


A stack is an ordered collection of items into which new items may be inserted and from which item may be deleted at only one end, called TOP of the Stack
  • Stack is a LIFO(Last In First Out)
  • Stack is a linear structure
  • Stack is a ordered list of elements of the same type.

 Operations of stack:

There are two operations :
  • PUSH (when an item is inserted to stack)
    • PUSH(s, i); adds the item I to the top of the stack
  • POP (when an item is removed from stack)
    • POP(s); Removes the top element and returns it as a function value



 Stack Can be implemented in two ways

  • Array
  • Linked List

 Applications of stack

  1. Parsing
  2. Recursive Function
  3. Calling Function
  4. Expression Evaluation
  5. Expression Conversion
    1. Infix to postfix
    2. Infix to prefix
    3. Postfix to infix
    4. Prefix to infix
  6. Towers of Hanoi


To Download click Here
Posted by Unknown On 02:35 No comments

0 comments:

Post a Comment

  • RSS
  • Delicious
  • Digg
  • Facebook
  • Twitter
  • Linkedin
  • Youtube

Blog Archive

Contact Us


Name

E-mail *

Message *