Computer Science 112:

Introduction to Computer Science II

Gregory M. Kapfhammer


flickr photo by by physician1977 shared under a CC Public Domain Dedication (CC0)

Color Scheme

Key Concept

Corresponding Diagram

In-Class Discussion

In-Class Activity

Details in the Textbook

No O(1) operations?

Let's investigate two more data structures!

LIFO?

FIFO?

LILO?

Stack Applications

Web browsers

Text Editors

HTML Checkers

Programming Languages

Stack Methods

push

pop

size

isEmpty

How do these methods operate?

java.util.Stack

top versus peek

Stack with an array

Placement of the array?

Benefits?

Limitations?

Worst-case time complexities

Stack with a linked list

Position of the list?

Benefits?

Limitations?

Worst-case time complexities

Questions about the stack?

Queue data type

Queue Applications

Operating Systems

Network routers

Web Servers

Printers

Queue Methods

enqueue

dequeue

first

size

isEmpty

How do these methods operate?

Array-based queue

Node-based queue

Trade-offs for these implementations?

Worst-case time complexities

Any questions about queues?