State True or False. i) Binary search is used for searching in a sorted array. AND ii) The time complexity of binary search is O(log n). A) True, False B) False, True C) False, False D) True, True Explain
D) TRUE,TRUE.
i) Binary search searcha sorted array by repeatedly dividing the search interval in half .If the value of the search key is less than the item in the middle of the interval ,narrow the interval to the lower half.Otherwise, narrow it to th eupper half.Repeat the steps and check untill the value is found or the interval becomes empty.
ii) The time Complexity of Binary search is O(log n)
.
-------------------------------------------------thank You----------------------------------------------------------------------------------
Get Answers For Free
Most questions answered within 1 hours.