{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

PRIORITY QUEUE PRINTOUT -...

Info icon This preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
#include<stdio.h> #include<conio.h> #define max 10 /*RISHI AGARWAL PRIORITY QUEUE   ROLL NO 02   SE CMPN A */ struct process {  int pri;  char disc[30]; }; struct priqueue {  int arr[max];  int front;  int rear;  struct process z[max]; }; int del(struct priqueue *s) {  int d;  if((s->front==-1))  {   printf("Array is empty");   return NULL;  }  d=s->arr[s->front];  if(s->front==s->rear)  {   s->front=-1;   s->rear=-1;  }  else  { (s->front)++; }  return d; } void display(struct priqueue *s) {  int i=0;   if((s->front==-1))  {   printf("Array is empty");   return;
Image of page 1

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
 }    printf("Data Priority Disc \n");  for(i=s->front;i<=s->rear;i++)  {printf("%-4d %-8d %s \n",s->arr[i],s->z[i].pri,s->z[i].disc);} } void insert(struct priqueue *s,int v,struct process r) {  int i,j,t;  if(s->rear==max-1)  {   printf("Array is full");   return;  }  if(r.pri<1||r.pri>10)  {   printf("Invalid Priority\n");   return;  }   if((s->front==-1))  {   s->front=0;   s->arr[s->front]=v;   s->z[s->front]=r;   (s->rear)++;   return;  }
Image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern