22

According to http://dictionary.reference.com

push

verb (used with object)

  1. to press upon or against (a thing) with force in order to move it away.

  2. to move (something) in a specified way by exerting force; shove; drive: to push something aside; to push the door open.

  3. to effect or accomplish by thrusting obstacles aside: to push one's way through the crowd.

  4. to cause to extend or project; thrust.

  5. to press or urge to some action or course: His mother pushed him to get a job.

This IMO fits to FIFO queues. Is there an explanation for this?

doc
  • 223

4 Answers4

47

According to legend, the original stack received its name by analogy to the stacks of dishes in the university cafeteria: you put one on top, and the (spring-loaded) stack of dishes goes down a bit, you take one away and it pops up a bit. Therefore 'pushing' received a connotation of operating downwards, even though you don't actually push down on the plate - you just set it down and gravity does the work. "Pushdown stack" is still a common phrase, and stacks tend to grow downwards in memory (i.e. with decreasing memory addresses), although it is doubtful whether that has anything to do with dish stacks or not.

Kilian Foth
  • 110,899
45

Think about a Pez dispenser. That's your mental model for a stack - last in, first out. So adding an item to a stack requires you to push down the existing items to make room.

https://i.sstatic.net/VJkYi.jpg

gnat
  • 20,543
  • 29
  • 115
  • 306
4

The illustrations using cafeteria plates or trays, pez dispensers, and piles of books all came later. From Wikipedia: (with references)

"The stack was first proposed in 1946, in the computer design of Alan M. Turing (who used the terms "bury" and "unbury") as a means of calling and returning from subroutines." Additional work and patents by others followed in 1957. The current illustrations of stacks we use today may have caused Turing's original terms of bury and unbury to evolve into push and pop. Maybe these terms just sound better.

Finding exactly where or when this happened is the answer to the OP's question. Maybe the answer is buried in one of the Wikipedia references like "Verfahren zur automatischen Verarbeitung von kodierten Daten und Rechenmaschine zur Ausübung des Verfahrens."

Bratch
  • 212
3

FIFO is a Queue - the first one added to the group is the first one served.

LIFO is a Stack - like a bunch of trays. You always take the one from the top of the stack.

The term push is used when adding an item to the LIFO/Stack, because at some cafeterias the stack of trays is on a spring loaded surface. As more items are pushed on the stack, the entire stack sinks lower.

When the top/newest item is removed from the stack, the top one is "popped" off the top of the stack.