Link

Stacks and Queues Study Guide

Data types. A variable’s data type (or simply type) determines its possible values and operations.

Abstract data types. A data type that does not specify any one implementation.

Stacks and queues. Understand the semantics of each. Understand why we would bother using stacks and queues when lists can do everything a stack and queue can do (and more).

Linked nodes. Understand how they can be used to implement a stack or a queue and how to show that queue and stack operations complete in constant time.

Resizable arrays. Understand how they can be used to implement a stack or a queue. Understand the runtime tradeoffs between linked nodes and resizable arrays.

Contract. Assuming both the client and the implementer agree to the abstract data type’s possible values and operations, the client and implementer can improve their programs at the same time.

Invariant. A checklist of assumptions the implementer needs to maintain every time they add a behavior to a data structure. Understand how different choices of invariants affects the way we implement ArrayStack, LinkedStack, ArrayQueue, and LinkedQueue. Understand how invariants affect the runtime of data structure operations.

Implementer’s Design Decision Hierarchy. Understand how the choice of abstract data type, data structure, and invariants (implementation details) each play a role in the implementation of an abstract data type.

Generics. Understand that these provide the ability to parameterize data types. Understand why this approach is superior to other approaches (writing separate classes, using the Object type and doing runtime casting).

  1. Textbook 1.3 Exercise 6
  2. Textbook 1.3 Exercise 3
  3. Textbook 1.3 Exercise 5