Question: Objectives Review the C programming language. Learn how to use the Netbeans Integrated Development Environment ( IDE ) for C programs Implement a Priority Queue

Objectives
Review the C programming language.
Learn how to use the Netbeans Integrated Development Environment (IDE) for C
programs
Implement a Priority Queue using a linked list.
Problem description
You need to implement a Priority Queue using a linked list.
A Priority Queue is used in Operating Systems kernel as part of the scheduling algorithm. Briefly,
when a process cannot continue running (perhaps because it is waiting for some event such as
input/output), the OS has to choose which waiting process that is ready to run gets control of the
CPU. Part of this algorithm involves a priority queue where the ready processes are ordered by their
priority. All things being equal, the highest priority task will be allowed to run.
Template code is given to you. You need to implement the functions PQ_insert and PQ_delete
functions.
You are given the header file pri_queue.h:
#ifndef PRI_QUEUE_H
#define PRI_QUEUE_H
typedef struct node {
int priority;
char * data;
struct node * next;
} Node_t,* Node_ptr_t;
extern void PQ_insert( int, char *);
extern Node_ptr_t PQ_delete();
extern Node_ptr_t PQ_get_head();
extern int PQ_get_size();
#endif /* PRI_QUEUE_H */
This header file defines new data types:
Node_t: A data structure for the nodes in the Priority Queue linked list. Each node contains its
priority, data (a string) and a pointer to the next node in the list. (If a node is the last one on the
list its next is NULL.)

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!