data structure, stack, stack data structure

Uploaded on


More in: Education , Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads


Total Views
On Slideshare
From Embeds
Number of Embeds



Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

    No notes for slide


  • 1. Stack Presentation on Stack By Patta Jagadeeswara Rao, Software Engineer, Patta Jagadeeswara Rao, MCA.
  • 2. Introduction to Stack  A Stack is a Linear Data Structure.  The Data Items in the stack are inserted and deleted from one end. That is called Top of the stack.   Stack follows LIFO (Last In First Out) Mechanism. Stacks are mostly used in system software. Like compilers and Operating Systems, etc..  Insert values into stack is called push operation.  Reading Values from stack is called pop operation. Patta Jagadeeswara Rao, MCA.
  • 3. Introduction to Stack (Cont..)  The Stack starts with position of 0(zero) .  The Maximum Position of Stack is n-1.    When The position of Stack is zero. Then, the stack is underflow. When The position of Stack is grater than n-1. Then, the stack is called overflow. Once an item is popped from stack, it is no longer available. Patta Jagadeeswara Rao, MCA.
  • 4. Stack Operations     There are Two operations in stack. Those are push and pop. The push operation is used to insert the values into stack. The pop operation is used to Retrieve the values from the stack. The best example for stack is the bunch of plates in the kitchen. Patta Jagadeeswara Rao, MCA.
  • 5. Example for stack # include <stdio.h> # include <conio.h> char jaggu[100]; int top = 0; void push(void); void pop(void); void main() { Patta Jagadeeswara Rao, MCA.
  • 6. Example for stack(cont..) Int ch = 0; while(1) { printf(“1. Add new item”); printf(“2. Delete item”); printf(“3. Quit”); printf(“Enter Your Choice :”); scanf(“%d”, &ch); Patta Jagadeeswara Rao, MCA.
  • 7. Example for Stack(cont..) switch(ch) { case 1: push(); break; case 2: pop(); break; case 3: return; }}} Patta Jagadeeswara Rao, MCA.
  • 8. Example for Stack(cont..) Void push(void) { if(top >=100) { printf(“stack if full”); return; } else Patta Jagadeeswara Rao, MCA.
  • 9. Example for stack(cont..) { printf(“ The item is : %ch”, gets(jaggu[top])); if(!jaggu[top]) { top ++; } } Patta Jagadeeswara Rao, MCA.
  • 10. Example for stack(cont..) Void pop(void) { top - - ; if(top < 0) { printf(“stack is empty”); return; } printf(“The item is :%ch”, jaggu[top]);} Patta Jagadeeswara Rao, MCA.
  • 11. Thank You Patta Jagadeeswara Rao, MCA.