Difference between revisions of "Stack"

From ScienceZero
Jump to: navigation, search
 
Line 1: Line 1:
 +
A stack is a last in, first out structure, imagine it as a stack of magazines on a desk. A stack is a fundamental computer science data structure that is at the heart of most programming languages.
 +
 
There are four types of stack:
 
There are four types of stack:
 
#Full Descending stack
 
#Full Descending stack

Latest revision as of 02:30, 23 January 2011

A stack is a last in, first out structure, imagine it as a stack of magazines on a desk. A stack is a fundamental computer science data structure that is at the heart of most programming languages.

There are four types of stack:

  1. Full Descending stack
  2. Empty Descending stack
  3. Full Ascending stack
  4. Empty Ascending stack
  • Empty - The stack pointer points to the next free slot
  • Full - The stack pointer points to the last item put on the stack
  • Decending - The stack pointer decreases in value when items are placed on the stack
  • Ascending - The stack pointer increases in value when items are placed on the stack

The convention when writing several stack elements on one line is that the top of stack is at the right.


Also see