Stacks, Queues, and Deques - PowerPoint PPT Presentation

About This Presentation
Title:

Stacks, Queues, and Deques

Description:

A last-in, first-out or LIFO data structure. Basic operations: Push, Pop and Top ... Iter class member function definition. Stack as Linked List ... – PowerPoint PPT presentation

Number of Views:143
Avg rating:3.0/5.0
Slides: 22
Provided by: scie218
Category:
Tags: deques | iter | queues | stacks

less

Transcript and Presenter's Notes

Title: Stacks, Queues, and Deques


1
Stacks, Queues, and Deques
  • Chapter 6

2
Object Class Hierarchy
3
Stacks
  • Array version
  • Linked-list version
  • applications

4
Stacks
  • A last-in, first-out or LIFO data structure
  • Basic operations Push, Pop and Top

5
Basic Stack Operations
6
Stack Class Definition
7
Stack as Array
8
Constructor, Destructor and Purge() member
functions
9
Push() Pop() and Top()
10
Accept()
11
Iterator
12
Iter class member function definition
13
Stack as Linked List
14
Constructor, Destructor and Purge() member
functions
15
Push() Pop() and Top()
16
Accept()
17
Iterator
18
Application
  • Infix Notation binary operands appear in between
    their operands. (59)265
  • Prefix Notation (polish notation) binary
    operators precede their operands. No parenthesis
    needed.
  • 5 9 2 6 5
  • ( ( ( 5 , 9 ) , 2 ) , ( 6 , 5 )
  • Postfix Notation binary operators follow their
    operands. No parenthesis needed.
  • 5 9 2 6 5

19
Evaluating Postfix Expressions
20
Evaluating Postfix Expression
  • 5 9 2 6 5

21
Implementation
Write a Comment
User Comments (0)
About PowerShow.com