Posts

Showing posts with the label Write a Program in c to implement Priority Queues using arrays

Write a Program in c to implement Priority Queues using arrays

/* Write a Program in c to implement Priority Queues using arrays*/    #include<stdio.h> #include<conio.h> #define MAX 5 void insert_by_priority(int); void delete_by_priority(int); void create(); void check(int); void display_pqueue(); int pri_que[MAX]; int front, rear; void main() {     int n, ch;     printf("\n1 - Insert an element into queue");     printf("\n2 - Delete an element from queue");     printf("\n3 - Display queue elements");     printf("\n4 - Exit");     create();     while (1)     {         printf("\nEnter your choice : ");         scanf("%d", &ch);         switch (ch)         {         case 1:             printf("\nEnter value to be inserted : ");             scanf("%d",&n);             insert_by_priority(n);             break;         case 2:             printf("\nEnter value to delete : ");             scanf("%d",&n);             delete_by_prior