2075 11

CSC211 ยท 2075 ยท 5 marks

How do you implement binary search algorithm? What is time complexity of this algorithm?

How do you implement binary search algorithm? What is time complexity of this algorithm? [5]

Data Structures and AlgorithmsChapter 7: Searching and HashingIntroduction to Searching, Search Algorithms

Binary search is a searching algorithm that works only on sorted lists. It repeatedly divides the search space in half by comparing the target element with the middle element of the list. --- --- Consider sorted array: A = [10, 20, 30, 40, 50, 60, 70], Search key = 40 Step low high mid A[mid] Act...