Friday, October 16, 2009

Stacks

A stack is an ordered dynamic linear list in which all additions of new elements and deletions of existing elements are restricted to one end, called the Top. If a data series is inserted into a stack, and then removed it, the order of the data would be reversed. This reversing attribute due to addition and removal at the top of stack give a special behaviour, called as “Last-in, first-out” (LIFO) structure.

A stack is dynamic because it is constantly changing objects, it expands and shrinks with passage of time.

The basic Stack operations are Create Stack, Push, Pop, Stacktop, Emptystack, Full stack, Stack Counts,

And Destroy stacks.

We shall also study the following application of stacks, reversing data (convert decimal to

binary) parsing data (matching of parentheses in source programs), postponing data usage (Infix, Postfix, Prefix and evaluation of Postfix expressions.) Stack frames concept is studied in a separate chapter on recursion.

No comments:

Post a Comment