Skip to content

Beta · Data may be lost.Your data may be reset or lost.

GateBrew
← GATE CSE 2016 Set 1
Questions

Q34

MCQ2 marks, −0.67Medium

The following function computes the maximum value contained in an integer array P[ ]P[ \ ] of size nn (n>=1)(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:

Sign in to save attempts.

Solutions and discussion are hidden while you attempt this question. They open once you check or show the answer.