FILL_IN_THE_BLANK_FOR_PROGRAMMING:The Largest Missing Integer
Given an array `a[]`of `n` integers, the function `MissingMax` is to find and return the maximum negative integer which is **NOT** in the array. For example, given { -3, -1, 8, 1, 0 }, -2 is the largest negative integer which is missing.
```c++
int MissingMax( int a[], int n )
{
int i, j, max, missing = -1;
for( i=0; imax = i;
for( j = i+1; j < n; j++ )
if (@@[a[j]>a[max]](3)) max = j;
if ( max != i ) swap(a[i], a[max]);
if ( a[i] == missing ) missing--;
else if ( a[i] < missing ) @@[break](3);
}
return missing;
}
```
answer:The first empty: a [J] > a [Max]
Second empty: break
```c++
int MissingMax( int a[], int n )
{
int i, j, max, missing = -1;
for( i=0; i
for( j = i+1; j < n; j++ )
if (@@[a[j]>a[max]](3)) max = j;
if ( max != i ) swap(a[i], a[max]);
if ( a[i] == missing ) missing--;
else if ( a[i] < missing ) @@[break](3);
}
return missing;
}
```
answer:The first empty: a [J] > a [Max]
Second empty: break