GATE Computer Science (CS) 2016 Shift 1 Solved Paper
© examsiri.com
Question : 44 of 65
Marks:
+1,
-0
The following function computes the maximum value contained in an integer array p[] of size n (n>= 1).
int max (int *p, int n) {
int a = 0, b = n – 1;
while(__________) {
if(p[a] <= p[b]) { a = a+1; }
else { b = b-1; }
}
return p[a];
}
The missing loop condition is
int max (int *p, int n) {
int a = 0, b = n – 1;
while(__________) {
if(p[a] <= p[b]) { a = a+1; }
else { b = b-1; }
}
return p[a];
}
The missing loop condition is
Go to Question: