O'Reilly logo

C# 5.0 Unleashed by Bart De Smet

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Stack

Everyone should know the concept and operation of a stack by now. We encountered stack data structures when discussing call stacks and evaluation stacks.

Stacks are last-in, first-out (LIFO) collections. Compare it to a stack of books where it’s (nearly) impossible to get a book other than the one at the top without popping the books on top of it off the stack first. The basic operations are called Push and Pop, and a Peek method allows looking at the top element without popping it off. Figure 16.4 graphically depicts the operation of a stack.

Image

FIGURE 16.4 Operation of a stack data structure.

To illustrate the use of a stack, take a look ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required