chapter 3.3.2 queue implementation
exercise 3.21