source code algorithm hrrn
#1

Hi ...

I need matlab code for simulation based on HRRN for tow queues.
thanks.
Reply
#2

#include<stdio.h>
#include<conio.h>
#include<process.h>
#include<string.h>
void main()
{
char p[10][5];
int et[10],wt[10],timer=3,count,pt[10],rt,i,j,totwt=0,t,n=5,found=0,m;
float avgwt;
clrscr();
for(i=0;i<n;i++)
{
printf("enter the process name : ");
scanf("%s",&p[i]);
printf("enter the processing time : ");
scanf("%d",&pt[i]);
}
m=n;
wt[0]=0;
i=0;
do
{
if(pt[i]>timer)
{
rt=pt[i]-timer;
strcpy(p[n],p[i]);
pt[n]=rt;
et[i]=timer;
n++;
}
else
{
et[i]=pt[i];
}
i++;
wt[i]=wt[i-1]+et[i-1];
}while(i<n);

count=0;
for(i=0;i<m;i++)
{
for(j=i+1;j<=n;j++)
{
if(strcmp(p[i],p[j])==0)
{
count++;
found=j;
}
}
if(found!=0)
{

wt[i]=wt[found]-(count*timer);
count=0;
found=0;
}
}
for(i=0;i<m;i++)
{
totwt+=wt[i];
}
avgwt=(float)totwt/m;
for(i=0;i<m;i++)
{
printf("\n%s\t%d\t%d",p[i],pt[i],wt[i]);
}
printf("\ntotal waiting time %d\n",totwt);
printf("total avgtime %f",avgwt);
}
Reply

Important Note..!

If you are not satisfied with above reply ,..Please

ASK HERE

So that we will collect data for you and will made reply to the request....OR try below "QUICK REPLY" box to add a reply to this page
Popular Searches: source code algorithm hrrn, hrrn code matlab,

[-]
Quick Reply
Message
Type your reply to this message here.

Image Verification
Please enter the text contained within the image into the text box below it. This process is used to prevent automated spam bots.
Image Verification
(case insensitive)

Possibly Related Threads...
Thread Author Replies Views Last Post
  simple java rmi chat application source code 2 18,982 20-07-2018, 12:08 PM
Last Post: Guest
  authentication schemes for session passwords using color and images project source code 2 2,231 03-02-2018, 09:35 AM
Last Post: Nischithnash
  free download source code for online movie ticket booking in java 2 18,492 15-08-2017, 03:21 PM
Last Post: Morshed
  source code for rsa encryption and decryption in java 2 7,928 29-05-2017, 04:21 PM
Last Post: Meghna Jadhav
  image encryption and decryption using rsa algorithm in matlab 2 7,828 29-05-2017, 04:17 PM
Last Post: Priyanka Bidikar
  download liver tumor ct scan image in matlab with source code 4 7,986 21-05-2017, 09:54 PM
Last Post: abdulrahmanmashaal
  online cab booking source code in asp net 3 7,862 11-05-2017, 10:39 AM
Last Post: jaseela123d
Thumbs Up online catering management system on php with report and source code and ppt 4 8,718 29-04-2017, 10:59 AM
Last Post: jaseela123d
  source code for task scheduling using genetic algorithm using java 2 8,446 11-04-2017, 08:31 PM
Last Post: Guest
  automatic timetable generator source code vb 1 7,524 07-04-2017, 12:31 PM
Last Post: jaseela123d

Forum Jump: