Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
inputoutput 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 PQinsert and PQdelete
functions.
You are given the header file priqueue.h:
#ifndef PRIQUEUEH
#define PRIQUEUEH
typedef struct node
int priority;
char data;
struct node next;
Nodet Nodeptrt;
extern void PQinsert int, char ;
extern Nodeptrt PQdelete;
extern Nodeptrt PQgethead;
extern int PQgetsize;
#endif PRIQUEUEH
This header file defines new data types:
Nodet: 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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started