plates are popped from the stack

taraa

Senior Member
Persian
Can you please explain the part in bold?

The INSERT operation on a stack is often called PUSH, and the DELETE operation, which does not take an element argument, is often called POP. These names are allusions to physical stacks, such as the spring-loaded stacks of plates used in cafeterias. The order in which plates are popped from the stack is the reverse of the order in which they were pushed onto the stack, since only the top plate is accessible.

Introduction to algorithms, cormen
 
  • PaulQ

    Senior Member
    UK
    English - England
    These names are allusions to physical stacks, such as the spring-loaded stacks of plates used in cafeterias.
    I am not convinced that this is the correct derivation. I have never heard of plates being popped from the stack.

    To pop = to move something in a very short time and without much effort, "I popped the cake into the oven" "I've popped your keys onto the table."

    In this respect, the OED gives
    2. a. transitive. To put or move (something) quickly, suddenly, or unexpectedly (usually with in, on, into, etc.). Also: to push or thrust up.

    I suspect that the idea of deleting = popping comes from

    1. transitive. colloquial. To strike, punch, knock; to deliver (a blow) to a person
    1958 J. Barth End of Road iv. 56 I popped her one on the jaw. Laid her out cold.
    or
    7. slang.
    a. transitive. To kill, destroy. Usually with off.
    1649 Mercurius Aulicus 21–28 Aug. 14 If they should transcend the bounds of their Commissions, and preach true doctrine for Heresie, they may chance to be popp'd off, or swing for't.
     
    Last edited:

    Andygc

    Senior Member
    British English
    PaulQ, the figurative plates (items of data) are popped from the figurative pile of plates (the stack). The words "push" and "pop" have specific meanings when used to refer to the manipulation of stack memory. Push - add a plate (data byte) to the stack. Pop - remove a plate (data byte) from the stack. Other meanings of "push" and "pop" are not relevant.

    I meant the literary meaning here?
    The literal meaning.

    I was referring to the literal meaning of "pop" when discussing stack manipulation.
     
    Last edited:
    Top