What is Binary Search?
Binary search is an effective method for finding a specific value in a sorted array by repeatedly dividing the search interval in half based on the middle value.
Search Process
-
Check the Middle Point
: Determine the search range by checking the value at the middle point of the array. -
Reduce the Range by Half
: If the target value is greater or smaller than the middle point value, reduce the search range by half. -
Repeat
: Continue this process until the target value is found or the search range is empty. -
Time Complexity (O(log n))
: The time complexity of binary search increases logarithmically with the number of elements.
Lecture
AI Tutor
Design
Upload
Notes
Favorites
Help