Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 10. Queues > 10.5 A DYNAMIC QUEUE CLASS

10.5 A DYNAMIC QUEUE CLASS

We need to decide upon the data to be stored in the queue. For simplicity, assume that the queue contains integer values. Create an appropriate QueueNode class, then a class description that has as attributes two QueueNode class pointers, head and tail, and as its methods enqueue and dequeue.

For the QueueNode class, include a constructor method for a new node, with an argument passed to the node when it is created as the value of its data component (Listing 10.1).


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free 10-Day Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint