EX 5.6 Compare and contrast the enqueue method of the LinkedQueue class to the
push method of the LinkedStack class from Chapter 4.
EX 5.7 Describe two different ways the isEmpty method of the LinkedQueue class
could be implemented.
In addition to checking the value of count, a queue will be empty only if the reference
EX 5.8 Name five everyday examples of a queue other than those discussed in this
chapter.
(1) Standing in line at the grocery store check out, (2) cars waiting in line at an
EX 5.9 Explain why the array implementation of a stack does not require elements to
be shifted but the noncircular array implementation of a queue does.
All operations on a stack occur on one end of the stack (the top). Therefore, the bottom
of the stack can remain at location 0 of the array at all times. Operations on a queue,
EX 5.10 Suppose the count variable was not used in the CircularArrayQueue class.
Explain how you could use the values of front and rear to compute the number
of elements in the list.
The difference between the front and rear indexes indicates the number of elements in
the list, but the circular nature of the array must be taken into account. The following
code could be used: