Question: Please write in c. Thank you A priority queue is a FIFO list, maintained in sorted priority order. For this assignment, keep the list in


Please write in c. Thank you
A priority queue is a FIFO list, maintained in sorted priority order. For this assignment, keep the list in ascending priority order (so that nodes having lower priority go in the front of the queue). Put your code in pqueue.netid.c and pqueue.netid.h Define these structs: typedef struct int id; char name[32] studentRecord; typedef struct PQueueStruct int priority void *data; struct PQueuestruct *next; PQueueNode; Implement the following functions int enqueue (PQueueNode*pqueue, int priority, void *data) void dequeue (PqueueNodepqueue) void *peek (PQueueNode *pqueue) void printQueue (PueueNode *pqueue, void (printFunction) (void)) int getMinPriority(PQueueNode *pqueue) int queueLength (PQueueNode *pqueue) void printStudentRecord(void data) (1) enqueue (PQueueNodetpqueue, int priority, void data) This will put the data in the priority queue in the correct place. If there is already one or more nodes in the list having the same priority as the data that you are enqueueing, then put the new node after all of the nodes having that priority. Return zero from this function. (2) void dequeue (PQueueNode *pqueue) Remove the front of the list and return the data from that list node. If the pqueue is empty, then return NULL. (3) void *peek (PQueueNode pqueue) Return the data from the first node in the pqueue. If the pqueue is empty, then return NULL The peek operation does not actually remove a node from the pqueue! (4) void printQueue(PQueueNode *pqueue, void (printFunction) (void*)) Print each the data from each node in the queue. (5) int getMinPriority(PQueueNode *pqueue) etun the pronty the h puee s my, eum 1 (6) int queueLength (PQueueNode *pqueue) Return the number of nodes in the pqueue. (7) void printstudentRecord(void data) Print an instance of StudentRecord as "%s %d", with the name field and id field. Passing a function as a parameter For an example of how to use a function as a parameter, see function-parameter.c on the course gitlab site
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
