diya pooye
Never
#include<stdio.h> void main() { int n, head, max, diff, temp, temp_1=0, temp_2=0, seek=0; int i, j, k; printf("Enter max range of disk: "); scanf("%d", &max); printf("Enter initial head position: "); scanf("%d", &head); printf("Enter size of queue request: "); scanf("%d", &n); int queue[n+3], queue1[n+3], queue2[n+3]; printf("Enter the queue of disk portions to be read :"); for(i=1; i<=n; i++) { scanf("%d", &temp); if(temp >= head) { queue1[temp_1] = temp; temp_1++; } else { queue2[temp_2] = temp; temp_2++; } } for(i=0; i<temp_1-1; i++) { for(j=0; j<temp_1-i-1; j++) { if(queue1[j] > queue1[j+1]) { temp = queue1[j]; queue1[j] = queue1[j+1]; queue1[j+1] = temp; } } } for(i=0; i<temp_2-1; i++) { for(j=0; j<temp_2-i-1; j++) { if(queue2[j] > queue2[j+1]) { temp = queue2[j]; queue2[j] = queue2[j+1]; queue2[j+1] = temp; } } } queue[0] = head; for(i=1, j=0; j<temp_1; i++, j++) { queue[i] = queue1[j]; } queue[i] = max; queue[i+1]=0; for(i=temp_1+3,j=0; j<temp_2; i++, j++) { queue[i] = queue2[j]; } for(i=0; i<n+2; i++) { diff = abs(queue[i+1] - queue[i]); seek += diff; printf("%d->", queue[i]); }
Raw Text
-
Exploring the Link Between FitsPresso Coffee and Weight Loss
8 min ago
-
Vampire Krul Tepes fucks like a slut, anal - Sunako_Kirishiki
15 min ago
-
https://www.linkedin.com/events/oemketogummiesunitedkingdomnatu7189477585951629312/
16 min ago
-
ASFASFA
HTML | 28 min ago
-
https://rapidleanketoacvgummies-uwl207k.gamma.site/
36 min ago
-
ooiwi
37 min ago
-
Untitled
45 min ago
-
dghhtuturytu
45 min ago
-
Untitled
46 min ago
-
zk22
53 min ago