previous | index | next

Exercise 13.11

This exercise requires that you add dequeue! to the circular, two-vector implementation of the queue ADT.

This exercise is tested by repeatedly enqueueing and dequeueing items using a from-to-do utility procedure.

While enqueueing and dequeueing, the test makes four assertions, about what should be at the head of the queue (twice), what should be the vector length, and whether the queue is empty.

If your dequeue! is working, the output should be:

**************************************************************
Results for Exercise 13.11

Assertion OK:
(= (head queue) 5)

Assertion OK:
(= (vector-length (queue-cells queue)) 8)

Assertion OK:
(= (head queue) 14)

Assertion OK:
(empty-queue? queue)

See suggestions on next slide.


previous | index | next