Question: Priority Queue Suppose we define a priority queue using a circular doubly linked list as follows: struct node { /* Linked list node */ int

Priority Queue Suppose we define a priority queue using a circular doubly linked list as follows: struct node { /* Linked list node */ int info;/* info stored in this node */ struct node *next;/* Pointer to the next node in linked list *//*(or the front node of LL if this is the rear node) */ struct node *prev;/* Pointer to the next node in linked list *//*(or the rear node of LL if this is the front node) */ }: struct pq {/*Priority queue */ int size;/* Number of elements in queue */ struct node *front;/*pointer to the first node */ struct node *rear;/* Pointer to the last node */ }: Write an iterative (i.e., non-recursive) function to insert the given node, new, into a sorted priority queue. void insert (struct pq *queue, struct node *new){
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
