c program

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sekitoleko
    New Member
    • Sep 2006
    • 21

    c program

    what is the final stack after the following operations on an empty stack
    push(4),pop(),p ush(7),push(8), pop(),push(7),p ush(9),pop(),pu sh(8),push(5)
  • Soujiro
    New Member
    • Jan 2007
    • 35

    #2
    Originally posted by sekitoleko
    what is the final stack after the following operations on an empty stack
    push(4),pop(),p ush(7),push(8), pop(),push(7),p ush(9),pop(),pu sh(8),push(5)
    why are you asking this question?

    Code:
           bottom{XXXX}top of the stack   XXXX be the elements of the stack 
    
    emty          { }
    push(4)      { 4 }
    pop()          { }
    push(7)       { 7 }
    push(8)       { 7 8 }
    pop()           { 7 }
    push(7)       { 7 7 }
    push(9)       { 7 7 9 } 
    pop()          { 7 7 } 
    push(8)       { 7 7 8 }
    push(5)       { 7 7 8 5 }
    that's it

    Comment

    Working...