GATE | GATE CS 2008 | Question 85
Consider the data given in above question, the correction needed in the program to make it work properly is
(A) Change line 6 to: if (Y[k] < x) i = k + 1; else j = k-1;
(B) Change line 6 to: if (Y[k] < x) i = k – 1; else j = k+1;
(C) Change line 6 to: if (Y[k] <= x) i = k; else j = k;
(D) Change line 7 to: } while ((Y[k] == x) && (i < j));
Answer: (A)
Explanation: See Question 4 of https://www.geeksforgeeks.org/data-structures-and-algorithms-set-21/
Quiz of this Question
Recommended Posts:
- GATE | GATE CS 2008 | Question 69
- GATE | GATE CS 2008 | Question 84
- GATE | Gate IT 2008 | Question 70
- GATE | GATE CS 2008 | Question 83
- GATE | GATE CS 2008 | Question 85
- GATE | GATE CS 2008 | Question 80
- GATE | GATE CS 2008 | Question 71
- GATE | GATE CS 2008 | Question 72
- GATE | GATE CS 2008 | Question 73
- GATE | GATE CS 2008 | Question 74
- GATE | GATE CS 2008 | Question 75
- GATE | GATE CS 2008 | Question 76
- GATE | GATE CS 2008 | Question 77
- GATE | GATE CS 2008 | Question 78
- GATE | GATE CS 2008 | Question 79



