Help authour, Buy PDF Ebook >>>Click Here<<<
Data Structure Questions and Answers-Binary Search Iterative
Click on any option to know the CORRECT ANSWERS
Question 6 |
What is the average case time complexity of binary search using recursion?
O(nlogn) | |
O(logn) | |
O(n) | |
O(n^{2}) |
Question 6 Explanation:
T(n) = T(n/2) + 1, Using the divide and conquer master theorem.
Question 7 |
What are the applications of binary search?
To find the lower/upper bound in an ordered sequence | |
Union of intervals | |
Debugging | |
All of the mentioned |
Question 7 Explanation:
All of the mentioned can be realized by binary search.
Question 8 |
Choose among the following code for an iterative binary search.
public static int iterative(int arr[], int key) { int low = 0; int mid = 0; int high = arr.length-1; whil | |||||||||||||||||||
public static int iterative(int arr[], int key) { int low = 0; int mid = 0; int high = arr.length-1; while | |||||||||||||||||||
public static int iterative(int arr[], int key) { int low = 0; int mid = 0; int high = arr.length-
Binary Search can be categorized into which of the following?
Question 9 Explanation: Since 'mid' is calculated for every iteration or recursion, we are diving the array into half and then try to solve the problem.
Given an array arr = {5, 6, 77, 88, 99} and key = 88; How many iterations are done until the element is found?
Question 10 Explanation: Iteration1 : mid = 77; Iteration2 : mid = 88;
There are 10 questions to complete.
Download all FREE PDF Ebook >>>CLICK HERE<<< |