Question 41
The time taken by binary search algorithm to search a key in a sorted array of n elements is
Question 42
Match the following:
List - I | List - II |
(a) Sequential Search | (i) Dynamic programming principle |
(b)Branch - and - bound | (ii) repeatedly double index |
(c) Exponential Search | (iii) O(LogN) |
(d) Binary Search | (iv)O(N) |
codes:
(a) | (b) | (c) | (d) | |
(1) | (i) | (iv) | (iii) | (ii) |
(2) | (iv) | (i) | (ii) | (iii) |
(3) | (i) | (iv) | (ii) | (iii) |
(4) | (iv) | (ii) | (i) | (iii) |
Question 43
Question 45
Consider the following C program that attempts to locate an element x in an array Y[] using binary search. The program is erroneous. (GATE CS 2008)
1. f(int Y[10], int x) {
2. int i, j, k;
3. i = 0; j = 9;
4. do {
5. k = (i + j) /2;
6. if( Y[k] < x) i = k; else j = k;
7. } while(Y[k] != x && i < j);
8. if(Y[k] == x) printf (\"x is in the array \") ;
9. else printf (\" x is not in the array \") ;
10. }
On which of the following contents of Y and x does the program fail?
Question 46
T(n) = a⋅T(n/b) + f(n)Which one of the following options is correct about the recurrence T(n)?
Question 47
Question 50
There are 50 questions to complete.