#include <stdio.h>//writer 5396952 이현민 #include <stdlib.h> #include <memory.h> #define MAX_QUEUE_SIZE 100 typedef struct treeNode{ int data; struct treeNode *left; struct treeNode *right; } treeNode; //the names are up to the order when it checks current node's data typedef treeNode *element; typedef struct { element queue[MAX_QUEUE_SIZE]; int front; int rear; }queueType; void error(char *message){ fprintf(stderr,"%s\n", message); exit(1); } void init(queueType *q) { q->front = q->rear = 0; } int isEmpty(queueType *q) { return (q->front == q->rear); } int isFull(queueType *q) { return ( (q->rear+1) % (MAX_QUEUE_SIZE) == q->front); //checking if front is ascended rear = means rear arrived to unused queue cell, full } void enqueue(queueType *q ,element item) { if(isFull(q)) { error("Queue is full\n"); } q->rear = (q->rear+1) % MAX_QUEUE_SIZE;//simply it means