Help authour, Buy PDF Ebook >>>Click Here<<<
Data Structure Questions and Answers-Uniform Binary Search
Question 1 |
When is the uniform binary search an optimization over the usual binary search?
A table lookup is generally faster than an addition and a shift | |
Many searches will be performed on the same array | |
Many searches will be performed on several arrays of the same length | |
All of the mentioned |
Question 1 Explanation:
Suitable for architectures such as Knuth's MIX and MMIX and this algorithm was proposed by Donald Knuth.
Question 2 |
Which of the following is a suitable lookup table that can be used in the uniform binary search?(N is the number of elements in the array and the delta array is global)
public static void make....delta(int N) { int power = 1; int i = 0; do { int half = power; power <<= 1; delta[i | ||||||||||||||||||||||||||||
public static void make....delta(int N) { int power = 1; int i = 0; do { int half = power; power <<= 1; delta[iUPSC GS Questions answers
Given delta[4] is a global array and number of elements in the sorted array is 10, what are the values in the delta array?
Question 3 Explanation: Trace with respect to the make....delta function, always note that the last element is always 0.
Choose the appropriate code snippet that performs uniform binary search.
Question 4 Explanation: Unlike the usual binary search which a low, high and a mid variable and every time comparing the key with the mid value, the comparing index is obtained from the lookup delta table, choosing the left or right side of the array is same as with the normal binary search.
What is the time complexity of uniform binary search?
Question 5 Explanation: With every iteration we are dividing the array into two parts(though not equal halves), the complexity remains same as the normal binary search.
There are 5 questions to complete.
Help authour, Buy PDF Ebook >>>Click Here<<< |