#include void firstfit(int p_size[],int n,int m_size[],int m) { printf("\t\tFIRST FIT \n"); int i,j,flag,psize[100],msize[100]; for(i=0;i=psize[i]) { printf("%d ALLOCATED IN %d MEMORY BLOCK",psize[i],msize[j]); msize[j] = msize[j]-psize[i]; printf(" => %d SPACE REMAINING \n",msize[j]); flag=1; break; } } if(flag==0) { printf("%d CANNOT BE ALLOCATED \n",psize[i]); } } } void worstfit(int p_size[],int n,int m_size[],int m) { printf("\t\tWORST FIT \n"); int i,j,max,loc,psize[100],msize[100]; for(i=0;imax) { max = msize[j]; loc = j; } } if(max>=psize[i]) { printf("%d ALLOCATED IN %d MEMORY BLOCK",psize[i],msize[loc]); msize[loc] = msize[loc]-psize[i]; printf(" => %d SPACE REMAINING \n",msize[loc]); } else { printf("%d CANNOT BE ALLOCATED \n",psize[i]); } } } void bestfit(int p_size[],int n,int m_size[],int m) { printf("\t\tBEST FIT \n"); int i,j,max,loc,psize[100],msize[100]; for(i=0;i=psize[i]) { if(loc == -1) { loc = j; } else if(msize[loc]>msize[j]) { loc = j; } } } if(loc != -1) { printf("%d ALLOCATED IN %d MEMORY BLOCK",psize[i],msize[loc]); msize[loc] = msize[loc]-psize[i]; printf(" => %d SPACE REMAINING \n",msize[loc]); } else { printf("%d CANNOT BE ALLOCATED \n",psize[i]); } } } void main() { int i,p_size[100],m_size[100],n,m; printf("ENTER THE NUMBER OF PROCESS : "); scanf("%d",&n); printf("ENTER THE ARRAY OF PROCESS : "); for(i=0;i