Skip to content

Latest commit

 

History

History
9 lines (6 loc) · 874 Bytes

File metadata and controls

9 lines (6 loc) · 874 Bytes

Main Page

Stack

About

A stack is an example of a linear data structure. Linear data structures are collections of components arranged in a straight line. When we add or remove components of linear data structures, they grow and shrink. If we restrict the growth of a linear data structure so that new components can only be added or removed only at one end, we have a stack.

Where is it used

In general, stacks are useful for processing nested structures or for functions which call other functions (or themselves). A nested structure is one that can contain instances of itself embedded within itself. For example, algebraic expressions can be nested because a subexpression of an algebraic expression can be another algebraic expression. Stacks are used to implement functions, parsers, expression evaluation, and backtracking algorithms.