Computers and Technology
Computers and Technology, 02.05.2021 02:10, rhd112458

The Queue1 class is a naive implementation of a queue using the provided functionality of the MyVector. The Queue2 class will alter the MyVector behavior by introducing a circular array pattern to the array stored. And, the Queue3 class is a naive implementation of a queue using the default behavior of the List class. Provided Files:
proj10-ContainerIfc. h
proj10-Node. h
proj10-ContainerIfc. h
class BADINDEX {};
template
class ContainerIfc {
public:
virtual ContainerIfc & pushFront(T) =0;
virtual ContainerIfc & pushBack(T) =0;
virtual ContainerIfc & popFront(T&) =0; // throws BADINDEX
virtual ContainerIfc & popBack(T&) =0; // throws BADINDEX
virtual int getSize() =0;
virtual bool isEmpty() =0;
virtual T front() =0; // throws BADINDEX
virtual T back() =0; // throws BADINDEX
virtual T& operator [](int) =0; // throws BADINDEX
virtual void erase() =0;
};
proj10-Node. h - notice that this Node. h is different from the previous MyList implementation
template
class Node {
public:
T data;
Node *next;
Node( T d ) {
data = d;
next = NULL;
}
~Node( ) {
delete next;
}
};
Deliverables:
proj10-driver. cpp
proj10-MyVector. h
proj10-MyList. h
proj10-Queue1.h
proj10-Queue2.h
proj10-Queue3.h
proj10-driver. cpp
Your driver should randomly generate and enqueue 100 integer values in each queue implementation. It should then time (using the time() fucnction) the dequeue of all integer values stored for each implementation of the queue independently. I encourage each of you to experiment locally with much larger numbers of integers to demonstrate the performance (efficiency) differences between these different queue implementations. Unfortunately, the upload site limits runtime for your programs to 1 second, and you won't be able to distiguish a difference between the runtimes of the different implementations in less than a second. So, our turned in version of the driver needs to be limited to 100 integers to ensure it completes all three implementations within that second of runtime.
proj10-MyVector. h
#include "proj10-ContainerIfc. h"
template
class MyVector : public ContainerIfc {
public:
MyVector ();
~MyVector ();
MyVector (const MyVector&);
MyVector& operator = (const MyVector&);
MyVector& pushFront(T);
MyVector& pushBack(T);
MyVector& popFront(T&); // throws BADINDEX
MyVector& popBack(T&); // throws BADINDEX
T front(); // throws BADINDEX
T back(); // throws BADINDEX
T& operator [](int); // throws BADINDEX
int getSize();
bool isEmpty();
void erase();
protected:
T *data;
int size;
int capacity;
void grow();
void shiftRight();
void shiftLeft();
};
proj10-MyList. h - notice that we are updating the original MyList implementation by adding a tail
#include "proj10-ContainerIfc. h"
#include "proj10-Node. h"
template
class MyList : public ContainerIfc {
public:
MyList();
~ MyList();
MyList(const MyList &);
MyList & operator = (const MyList &);
MyList & pushFront(T);
MyList & pushBack(T);
MyList & popFront(T&); // throws BADINDEX
MyList & popBack(T&); // throws BADINDEX
int getSize();
bool isEmpty();
T front(); // throws BADINDEX
T back(); // throws BADINDEX
T& operator [](int); // throws BADINDEX
private:
Node *head;
Node *tail;
};
proj10-Queue1.h - naive implementation of queue using your MyVector implementation
#include "proj10-MyVector. h"
template
class Queue1 : public MyVector {
public:
void enqueue( T );
void dequeue( T& ); // throws BADINDEX
};
proj10-Queue2.h - still uses the MyVector, but implemented using "circular" array
#include "proj10-MyVector. h"
template
class Queue2 : public MyVector {
private:
int front, rear;
public:
Queue2();
void enqueue( T );
void dequeue( T& ); // throws BADINDEX
};
proj10-Queue3.h - implementation using your MyList implementation
#include "proj10-MyList. h"
template
class Queue3 : public MyList {
public:
void enqueue( T );
void dequeue( T& ); // throws BADINDEX
};
Expert A

answer
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 21.06.2019 23:30, skywil8981
Step 1: choose your topics review the project milestone reflections you submitted for modules 1 through 4. choose the one major idea or concept from each module that you feel most applies to your life. in addition, choose an important concept from module 5 that applies to your life. step 2: write your guidebook for each module: write a catchy headline that clearly and concisely sums up your chosen idea or concept write a brief explanation that includes a description of the concept, why it is important, and how it can be applied to your life to make a positive impact choose an exciting, powerful, or engaging image that illustrates your concept remember, you are writing one for each module, so you will have a total of five headlines, five descriptions, and five images. step 3: design your guidebook choose a format to present your digital guidebook. there are many 21st century tools available for creating and submitting your work in the online environment. for more information on tools your school uses, contact your instructor or visit the web 2.0 tools area.
Answers: 3
image
Computers and Technology, 22.06.2019 00:20, orlando19882000
The pyraminx is a rubik's cube-type toy in the shape of a tetrahedron (not a pyramid). the pyraminx shown below has edges 15\,\text{cm}15cm15, space, c, m long and vertical height h=12.2\,\text{cm}h=12.2cmh, equals, 12, point, 2, space, c, m. the triangle drawn with dashed lines is a right triangle. what is the distance rrr? round your answer to the nearest tenth.
Answers: 1
image
Computers and Technology, 23.06.2019 07:30, jackie0833
Which option allows you to view slides on the full computer screen?
Answers: 1
image
Computers and Technology, 23.06.2019 18:00, sophx
Apunishment or the threat of punishment used to enforce conformity. select the best answer from the choices provided t f
Answers: 1
Do you know the correct answer?
The Queue1 class is a naive implementation of a queue using the provided functionality of the MyVect...

Questions in other subjects: