CameraIcon
CameraIcon
SearchIcon
MyQuestionIcon
MyQuestionIcon
4
You visited us 4 times! Enjoying our articles? Unlock Full Access!
Question

Consider the following C-function in which a [n] and b [m] are two sorted integer arrays and c [n+m] be another integer array.

void xyz (int a[ ], int b[ ], int c[ ])
{
int i, j, k;
i = j = k = 0;
while ((i < n) && (j < m))
if (a[i] < b[j])
c[k++] = a[i ++];
else
c[k++] = b[j ++];
}

Which of the following condition(s) hold after the termination of the while loop?

(i) j < m, k = n + j - 1 & a[n- 1] < b[j] if i = n
(ii) i < n, k = m + i - 1 & b[m- 1] ≤ a[i] if j = m

A
only (ii)
No worries! We‘ve got your back. Try BYJU‘S free classes today!
B
only (i)
No worries! We‘ve got your back. Try BYJU‘S free classes today!
C
neither (i) nor (ii)
Right on! Give the BNAT exam to get a 100% scholarship for BYJUS courses
D
either (i) or (ii) but not both
No worries! We‘ve got your back. Try BYJU‘S free classes today!
Join BYJU'S Learning Program
CrossIcon