vis
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+2], queue1[n+2], queue2[n+2]; 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; for(i=temp_1+2,j=0;j<temp_2;i++,j++) { queue[i] = queue2[j]; } for(i=0; i<n+1; i++) { diff = abs(queue[i+1] - queue[i]); seek += diff; printf("%d->", queue[i]); } printf("%d", queue[n+1]); printf("\nTotal seek time is %d\n", seek); printf("Average seek time is %f", seek/(float)n); }
Raw Text
-
Untitled
4 min ago
-
Rapid Lean Keto ACV Gummies contain stomach related
8 min ago
-
My First Day at Work! Big Tits ASMR by Masseur With No Experience | LilyKoti
24 min ago
-
Untitled
29 min ago
-
Untitled
36 min ago
-
Quick Books Customer Supports
42 min ago
-
https://www.facebook.com/RapidLeanKetoACVGummiesReview/
48 min ago
-
Untitled
50 min ago
-
Untitled
50 min ago
-
Japanese honey Haru Sakuraba got fucked uncensored
54 min ago