Question: Please do 3.2 3.1) The following programs can be used for self-studying for main operations(Insertions and Deletions of integer values)) of Circular Queues: Run and

Please do 3.2

Please do 3.2 3.1) The following programs can be used for self-studying

for main operations(Insertions and Deletions of integer values)) of Circular Queues: Run

3.1) The following programs can be used for self-studying for main operations(Insertions and Deletions of integer values)) of Circular Queues: Run and discuss the output. /* **** /* Queues main Operations */ 1* Inserting & Deleting Integer values into/from */ /* a Circular queue */ /* Insertion(I) and Deletion(D) Operationions */ /* End Of operation(E) */ */ #include #include #include #define MAXELEMENTS 5 #define TRUE 1 #define FALSE O // circular Queue insertion and deletion functions struct queue { int items[MAXELEMENTS]; int front, rear ; void cqinsert(struct queue * , int); int cqdelete(struct queue *); int empty(struct queue *); int main(void) { char operation; int x; struct queue ; q.front = q.rear = MAXELEMENTS - 1; do { printf("%s ", "Insert Operation type I D or E "); scanf(" %c",&operation); switch (operation) { case 'T': printf("%s ", "Insert an element"); scanf(" %d",&x); cqinsert(&q, x); break; case 'D':x=cqdelete(&q); printf(" %d is deleted ",x); break; } } while (operation != 'E'); return 0; } int empty(struct queue *pg) { return((pq->front == pq->rear) ? TRUE : FALSE); } int cqdelete(struct queue *pa) { if (empty(pa)) { printf("Queue underflow"); exit(1); } if (pq->front == MAXELEMENTS - 1) pq->front = 0; else (pq->front)++; return(pq->items(pq->front]); } void cainsert(struct queue *pq, int x) { ;* make room for new element */ if (pq->rear == MAXELEMENTS - 1) pq->rear = 0; else (pq->rear)++; if (pq->rear == pq->front) { printf("Queue overflow"); getchar(); getchar(); exit(1); } printf(" %d is inserted %d ",x); pq->items(pq->rear] = x; } 3.2) Do some modifications in the previous program and display the insertion and Deletion values and location points of the Circular Queue structure

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!