subject

Write the implementation file, priority_queue. c, for the interface in the given header file, priority_queue. h. Turn in your priority_queue. c file and a suitable main program, main. c, that tests the opaque object. priority_queue. h is attached as a file to this assignment but is also listed here for your convenience. Your implementation file should implement the priority queue using a heap data structure. Submissions that implement the priority queue without using a heap will not receive any credit. #ifndef PRIORITY_QUEUE_H
#define PRIORITY_QUEUE_H
enum status { FAILURE, SUCCESS };
typedef enum status Status;
enum boolean { FALSE, TRUE };
typedef enum boolean Boolean;
typedef void* PRIORITY_QUEUE;
//Precondition: Creates an empty priority queue that can store integer data items
// with different integer priority. Higher
// integer values indicate higher priority in the queue. For example, consider the
// priority and the data value to be key-value pairs where the priority is the key
// and the data is the value. The queue could hold 21,10 and 35, 5 so that the
// first item to be removed from the queue would be the data value 5 because
// it has higher priority (35) than the data value 10 which only has (21).
//Postcondition: Returns the handle to an empty priority queue.
PRIORITY_QUEUE priority_queue_init_default(void);< br /> //Precondition: hQueue is a handle to a valid priority queue opaque object.
// Higher priority_level values indicate higher priority in the queue.
// data_item is simply a value we are storing in the queue.
//Postcondition: returns SUCCESS if the item was successfully added to the queue
// and FAILURE otherwise.
Status priority_queue_insert(PRIORITY_QUEU E hQueue, int priority_level, int data_item);
//Precondition: hQueue is a handle to a valid priority queue opaque object.
//Postcondition: returns SUCCESS if the highest priority item was removed from the queue
// and FAILURE if the queue was empty.
Status priority_queue_service(PRIORITY_QUE UE hQueue);
//Precondition: hQueue is a handle to a valid priority queue opaque object.
//Postcondition: returns a copy of the data value for the
// highest priority item in the queue. Sets the variable at the address
// referred to in pStatus to SUCCESS if there is
// at least one item in the queue and FAILURE otherwise. If pStatus is
// passed in as NULL then the status value is ignored for this run of the
// function.
int priority_queue_front(PRIORITY_QUEUE hQueue, Status* pStatus);
//Precondition: hQueue is a handle to a valid priority queue opaque object.
//Postcondition: returns TRUE if the priority_queue is empty and FALSE otherwise.
Boolean priority_queue_is_empty(PRIORITY_QU EUE hQueue);
//Precondition: phQueue is a pointer to the handle of a valid priority queue opaque object.
//Postcondition: The opaque object will be free'd from memory and the handle pointed to
// by phQueue will be set to NULL.
void priority_queue_destroy(PRIORITY_QUE UE* phQueue);
#endif

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 20:30
Write 150 words on what kind of website would you like to make in the future? what sites would you like to model yours after?
Answers: 2
question
Computers and Technology, 22.06.2019 12:10
1. declare a constant named cents_per_pound and initialize with 25. 2. get the shipping weight from user input storing the weight into shipweightpounds. 3. using flat_fee_cents and cents_per_pound constants, assign shipcostcents with the cost of shipping a package weighing shipweightpounds.
Answers: 2
question
Computers and Technology, 23.06.2019 00:30
Which one of the following is considered a peripheral? a software b mouse c usb connector d motherboard
Answers: 2
question
Computers and Technology, 23.06.2019 09:30
You have been supporting csm tech publishing's windows server 2016 server network for over a year. the office has two windows server 2016 servers running active directory and a number of other roles. management has informed you that a small sales office is opening in the same building three floors up. the sales manager wants to install a sales application on a server located in the sales office. this server will have limited physical security because there's no special room dedicated for it, which means it will be accessible to non-it personnel and visitors. you're considering installing windows server 2016 server core on the new server because accessing its console regularly probably won't be necessary, and this server will be managed from one of the other csm tech publishing servers. what are the benefits and drawbacks of using server core for this branch office? what are some things you should do to set up this server management environment?
Answers: 1
You know the right answer?
Write the implementation file, priority_queue. c, for the interface in the given header file, priori...
Questions
Questions on the website: 13722360