Home EducationSubjectsIT Studies Subscribe to RSS

How Do Stacks Work?

How pop and push functions work?

Answer Question

1 Answer - Sort by: Date | Rating

    Stack work on first in first out basis..
    When we pop a stack it pop outs the top most value of a stack.
    For example we have following stack
    1
    2
    3
    4
    5
    6
    Now 1 is the top most value of the stack.. Now if we pop the stack, 1 which is the top most value will popped out of the stack and the stack will be
    2
    3
    4
    5
    6
    Now we push a value say 19
    In case of push the value which need to be pushed will be placed at the top of stack. After pushing 19 the stack will be:
    19
    2
    3
    4
    5
    6
    Hope it helps you!
    Sorry for poor English:)

    1 0

    Ar202 

    answered 12 months ago

      Answer Question - Answers are editable for 5 min.

      If you do not Sign-in or Register your answers will be anonymous,

      your answers may also be checked before going online.

      More

         
         

        Ask a Question via Twitter

        Send a question to @askblurtit and we will publish it online and send you a reply everytime you receive an answer.

        Blurtit Store

        Get T-shirts, hoodies, caps and more at the Blurtit store

        Blurtit International