Question: I have the code i just need help with converting to pseudo code using circular array?... Create a design documen t for the class implementation

I have the code i just need help with converting to pseudo code using circular array?...

Create a design document for the class implementation of a queue using an array of SIZE elements. Your routines should not declare an overflow (queue full) unless every slot in the array is used.

Clearly define your class with member functions and private data area. Class private data area only contain trackers front, rear and the array[SIZE].

Your design should be a document (not a complete C++ program) containing plain English and/or pseudo code on the logic suggested. A novice programmer should create the intended program from your design document.

Use a circular array implementation to create this design document for the following routines.

1. Enqueue() - Insert an element at the end of the queue called "rear". 2. Dequeue() - Delete and return the element at the start of the queue called "front" 3. DiplayQueue() - Print the values in the queue from front to rear. 4. Front() - return the value stored in the front of the queue 5. IsEmptyQ() - Return true if queue is empty, otherwise false. 6. IsFullQ() - Return true if queue is full, otherwise false. 7. CountQ() - Return Number of valid elements in queue.

#include #define MAX_SIZE 5 // Required Array Size using namespace std; class Queue { private: int cqueue[MAX_SIZE], front, rear; public: Queue(){ // Constructor front = -1; rear = -1; } // Checking for queue to be full or not bool IsFullQ() { if ((front == 0 && rear == MAX_SIZE-1) || (front == rear+1)) { cout<<"Queue is Full "; return true; } } // Checking for Queue empty or not bool IsEmptyQ() { if (front == -1) { cout<<"Queue Empty "; return true; } } // Inserting an element void Enqueue(int val) { if ((front == 0 && rear == MAX_SIZE-1) || (front == rear+1)) { // Check for Queue overflow cout<<"Queue is Full "; return; } if (front == -1) { front = 0; rear = 0; } else { if (rear == MAX_SIZE - 1) rear = 0; else rear = rear + 1; } cqueue[rear] = val ; } // Deleting and element from the Queue void Dequeue() { if (front == -1) { // Check for Queue Underflow cout<<"Queue Empty "; return ; } cout<<"Element deleted from queue is : "<>ch; switch(ch) { case 1: cout<<"Input for insertion: "<>val; Enqueue(val); break; case 2: Dequeue(); break; case 3: DiplayQueue(); break; case 4: IsFullQ(); break; case 5: IsEmptyQ(); break; case 6: Front(); break; case 7: cout<<"Exit "; break; default: cout<<"Incorrect! "; } } while(ch != 7); return 0; } }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!