Queue Implementation Using Linked List
Queue implementation using linked list gives following advantages: Linked list allow dynamic allocation of memory Insertion and deletion is easy Efficient memory utilization due to run time allocation Deletion of elements free the memory, that can further utilized by other programs Implementation of Queue First step to define the structure of the node Define two pointer called rear and front assigned with NULL Create the List of Operation in Main function Decide the condition for Queue empty or full Last inserted elements always pointed by rear #include #include struct node { int data; struct node *next; }*front=NULL,*rear=NULL; void Inqueue() { int n; struct node *newNode=(struct node*)malloc(sizeof(struct node)); printf("Insert the data"); scanf("%d",&n); newNode->data=n; if(rear==NULL) { front=newNode; rear=newNode; newNode->next=NULL; } else { rear->next=newNode; rear=newNode; } } void Dequeue() { if(front==NULL) printf(&q