Computer Science 112:

Introduction to Computer Science II

Gregory M. Kapfhammer


flickr photo shared by Billboard Art Project under a Creative Commons ( BY-NC-ND ) license

Color Scheme

Key Concept

Corresponding Diagram

In-Class Discussion

In-Class Activity

Details in the Textbook

LIFO?

FIFO?

LILO?

Stack Applications

Internet Web browsers

Text editors

Stack Methods

push

pop

size

isEmpty

How do these methods operate?

java.util.Stack

top versus peek

Stack with an array

Orientation of the array?

Benefits?

Limitations?

Worst-case time complexities

Stack with a linked list

Orientation of the list?

Benefits?

Limitations?

Worst-case time complexities

Stack applications

Matching HTML tags

Connections to the laboratory assignment

Questions about the stack?

Queue data type

Printers and web servers

Queue Methods

enqueue

dequeue

first

size

isEmpty

How do these methods operate?

Array-based queue

Store element to remove at zero?

Using an array circularly

Node-based queue

"Hot potato" with a queue

Double-ended queues

Any questions about queues?