#### Reading material

If you use the first edition of the textbook, follow the reading material
in orange. If you use the second edition,
follow the reading material in brown.
(1st)
pages 152-161 (Section 5.2.1-5.2.3),
pages 165-172 (Section 5.3.3),
pages 69-73 (Section 3.1.2),
pages 80-83 (Section 3.2.2)

(2nd)
pages 236-246 (Section 6.2.1-6.2.4),
pages 251-257 (Section 6.3.4),
pages 140-145 (Section 4.1.2),
pages 152-155 (Section 4.2.2)

#### Additional material

Implementation of a stack and queue with an array in
pseudocode: PostScript and
PDF
How the variables represent the data structure is captured by the
(class) invariant. It is an assertion which should hold after
initialization and which should be preserved by the operations
on the data structure.

ArrayStack

StackFullException

ArrayQueue

QueueFullException

To visualize how Java objects are used to implement data structures
like stacks and queues you may want to use the Java package
explicar.

#### Question

Give the variables, (class) invariant, and initialization of the
implementation of a ranked sequence by means of an array.