Test By Yourself
OJ Cannot judge this question
Test cases are uploaded to eecalss
Implement a Queue object. A Queue is also called a queueing structure, just like lining up at a convenience store checkout.
A queue has a front and a rear, and we can only insert at the rear of the queue and remove from the front of the queue.
Therefore, a queue has the characteristic of first-in-first-out (FIFO).
The header file of Queue is shown below.
Header File: (queue.h) Queue Header File
Functions related to Queue are as follows:
init initializes the queue.
empty checks whether the queue is empty.
enqueue inserts a piece of data at the rear of the queue.
dequeue removes a piece of data from the front of the queue.
The main program and input/output example are shown below.
Please implement all the Queue functions.
Example Program: (queue-main.c) Testing the Queue
A set of queue operation instructions (enqueue / dequeue)
Ex. (No input)
Results after correct simulation.
Ex. initially queue is empty
2
3
4
5
6