Data Structure Questions and Answers-Binary Search Iterative

 

 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 11
Given an array arr = {45, 77, 89, 90, 94, 99, 100} and key = 100; What are the mid values(corresponding array elements) generated in the first and second iterations?
A
90 and 99
B
90 and 100
C
89 and 94
D
94 and 99
Public administration Questions answers

Question 11 Explanation: 
Trace the input with the binary search iterative code.

Question 12
What is the time complexity of binary search with iteration?
A
O(nlogn)
B
O(logn)
C
O(n)
D
O(n2)
Visual arts Questions answers

Question 12 Explanation: 
T(n) = T(n/2) + theta(1)

Using the divide and conquer master theorem, we get the time complexity as O(logn).

There are 12 questions to complete.

 

 Download all FREE PDF Ebook >>>CLICK HERE<<<