程序代写代做代考 Test 1

Test 1

Prepare for Problem 4
Linked list implementation of Queue ADT
Finish all queue operations specified in queueLinked.h. Note that parts of codes in queueLinked.c have been given.
Please refer to array implementation of Queue ADT (i.e., queue.h/c in ~Code-c2e_all on ftp)

queueLinked.h/c
typedef int ElementType;
/* START: */
#ifndef _QueueLinked_h
#define _QueueLinked_h

struct QueueRecord;
typedef struct QueueRecord *Queue;

int IsEmpty( Queue Q );
void DisposeQueue( Queue Q );
void MakeEmpty( Queue Q );
void Enqueue( ElementType X, Queue Q );
ElementType Front( Queue Q );
void Dequeue( Queue Q );
ElementType FrontAndDequeue( Queue Q );
void PrintQueue( Queue Q);

#endif /* _Queue_h */
/* END */
#include “queueLinked.h”
#include
#include “fatal.h”
#include
typedef struct node
{
ElementType data;
struct node* next;
} QUEUE_NODE;
struct QueueRecord
{
QUEUE_NODE* front;
QUEUE_NODE* rear;
int count;
};
Queue CreateQueue (void)
{
// Local Definitions
Queue queue;

// Statements
queue = (Queue) malloc (sizeof (*queue));
if (queue)
{
queue->front = NULL;
queue->rear = NULL;
queue->count = 0;
} // if
return queue;
} // createQueue
queueLinked.h
queueLinked.c