Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

[C++] What I need done I think is a revised queue class in queue2.h using a circular linked list. It's using a regular linked list

image text in transcribed

[C++] What I need done I think is a revised queue class in queue2.h using a circular linked list. It's using a regular linked list now. I guess the implementation might need to be changed too but I don't know. Just do what you can please with heavy commenting.

-

-

Here are the files you may need:

-

queue2.h (queue class): https://codeshare.io/5XLqXK --- [This is the file that needs to be edited]

queue2.template (queue class implementation): https://codeshare.io/5Q8vbQ --- [Maybe needs changing?]

node2.h (node class for linked list): https://codeshare.io/29bnBV

node2.template (node class implementation): https://codeshare.io/5ezvo4

-

-

Let me know if there's something else you need and I may be able to get it for you.

In this chapter we gave a linked-list imple- mentation of a queue. This implementation used two named pointers called front ptr and rear ptr to point to the front and the rear nodes of the queue (linked list). A circular linked list is similar to a regular linked list, except that the pointer field in the "last node" points back to the "first node." (Of course, after this change it is no longer clear which node, if any, is intrinsically "first." If we use a circular linked list, then we need only one pointer to implement a queue, since the front node and the rear node are adjacent nodes, as shown by the following diagram: rear ptr LA Third item Second Fourth item item Front item In the diagram we have called the single pointer rear ptr, because it points to the last node in the queue. It turns out that this gives a more efficient im- plementation than having it point to the first node in the queue. Redo the queue class using a circular linked list. In this chapter we gave a linked-list imple- mentation of a queue. This implementation used two named pointers called front ptr and rear ptr to point to the front and the rear nodes of the queue (linked list). A circular linked list is similar to a regular linked list, except that the pointer field in the "last node" points back to the "first node." (Of course, after this change it is no longer clear which node, if any, is intrinsically "first." If we use a circular linked list, then we need only one pointer to implement a queue, since the front node and the rear node are adjacent nodes, as shown by the following diagram: rear ptr LA Third item Second Fourth item item Front item In the diagram we have called the single pointer rear ptr, because it points to the last node in the queue. It turns out that this gives a more efficient im- plementation than having it point to the first node in the queue. Redo the queue class using a circular linked list

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advances In Spatial And Temporal Databases 10th International Symposium Sstd 2007 Boston Ma Usa July 2007 Proceedings Lncs 4605

Authors: Dimitris Papadias ,Donghui Zhang ,George Kollios

2007th Edition

3540735399, 978-3540735397

More Books

Students also viewed these Databases questions

Question

LO4 Provide an overview of four challenges facing HR today.

Answered: 1 week ago