8.stack

8.stack - Stacks Readings: Ch. 5 (shown for next week)...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
Stacks [Bono] 1 Stacks • Readings: Ch. 5 (shown for next week) • Stack abstract data type (ADT) • applications • interface for a Stack class • ex use: reverse a string • representing stacks • stack class implementations as an example to learn about C++ features
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Stacks [Bono] 2 Stacks • a collection of things (like a vector is) • but with restricted access • the only item you can look at or remove is the last item you inserted. Last In First Out (LIFO). • E.g. stack of dishes – push a plate on the top of the stack – pop a plate from the top of the stack – examine the plate at the top of the stack – ask if the stack is empty Produced with a Trial Version of PDF Annotator - www.PDFAnnotator.com
Background image of page 2
Stacks [Bono] 3 Stacks for procedure call/return • a second example of a stack is the system stack (a.k.a., run- time stack, or call stack) • procedure call/return follows LIFO order. • last procedure called will return before any ones that called it.
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 8

8.stack - Stacks Readings: Ch. 5 (shown for next week)...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online