The QUEUE class
The header rasp, queue.h, should face like:
typedef struct queue QUEUE;
extern QUEUE *newQUEUE(vacant (*d)(FILE *,vacant *));
extern vacant enqueue(QUEUE *items,vacant *value);
extern vacant *dequeue(QUEUE *items);
extern vacant *peekQUEUE(QUEUE *items);
extern int magnitudeQUEUE(QUEUE *items);
extern vacant exhibitQUEUE(FILE *,QUEUE *items);
extern vacant visualizeQUEUE(FILE *,QUEUE *items);
The header rasp contains the administration signatures of your social ways occasion the edict module, queue.c, contains their implementations.
The singly persomal includes that queue.c should keep are queue.h and the header rasp of the underlying facts construction on which the marshal is naturalized.
Here are some of the behaviors your ways should keep. This listing is referable attributable attributable attributable exhaustive; you are expected, as a computer gownsman, to finished the implementation in the best likely and most close style.
newQUEUE – The producer is passed a administration that knows how to exhibit the collective rates stored in the queue. That administration is stored in a display field of the QUEUE object:
enqueue – The enqueue way runs in perpetual or amortized perpetual term. The rate to be enqueued is stored in the underlying facts construction.
removeQUEUE – The dequeue way runs in perpetual or amortized perpetual term. The rate to be dequeued is removed in the underlying facts construction.
peekQUEUE – The peek way inend the rate apt to end unstudied the queue, referablewithstanding leaves the queue unchanged. It runs in perpetual term.
sizeQUEUE – The magnitude way inend the number of items stored in the queue. It runs in amortized perpetual term.
displayQUEUE – This exhibit way prints the items stored in the queue. If the integers 5, 6, 2, 9, and 1 are enqueued in the adjust given, the way would propagate this output:
with no precedent or forthcoming whitespace. An leisure queue exhibits as <>.
visualizeQUEUE – The visualize way merely calls the exhibit way of the facts construction upon which the queue is naturalized.
Include the forthcoming assertions in your ways:
newQUEUE – The retrospect integralocated shintegral referable attributable attributable attributable be nothing.
dequeue – The magnitude shintegral be senior than nothing.
peekQUEUE – The magnitude shintegral be senior than nothing.