Question
Which of the following is NOT true about binary search ?
Solution
Binary search is an efficient searching algorithm designed to find an element in a sorted array. Its time complexity in the worst case is O(logā”n), not O(n), making option 2 incorrect. The process involves dividing the search space into two halves after every comparison. Binary search operates under the condition that the array is sorted. If not, it leads to undefined behavior or incorrect results. Option 1 is correct because the algorithm strictly requires a sorted array. The halving of the search space ensures logarithmic complexity, and this property is central to binary search, making option 3 valid. Binary search can be implemented both iteratively and recursively, which provides flexibility in practical applications, making option 4 correct. Additionally, the algorithm can handle various data types, including strings, as long as the data is comparable, confirming the correctness of option 5. The claim in option 2, that the time complexity is O(n), reflects a misunderstanding of how binary search reduces the problem size. O(n) is the complexity of linear search, which scans every element. Binary search leverages the sorted nature of data to skip unnecessary comparisons, making it much faster. Even in the worst case, where the element might not exist, the logarithmic reduction persists. Why Other Options Are Incorrect? 1. Requires a sorted array: True, as binary search is based on comparisons against the middle element in a sorted order. Unsorted arrays invalidate the algorithm's assumptions. 2.Halves search space after each comparison: Accurate. This halving mechanism is the foundation of binary search, reducing complexity to O(logā”n). 3. Implemented using recursion or iteration: Correct, as both methods achieve the same goal with slight differences in implementation details. 4. Works for numerical and string data: Valid, as long as the data has a natural ordering or a comparator function is defined.
The National Payments Corporation of India International recently signed a Memorandum of Understanding (MoU) with Lyra Network of __________ that will a...
Consider the following statements about the Global Excellence Award 2024 received by Chandrakant Satija:
Statement 1: Chandrakant Satija was reco...
Which Indian actor was appointed as Thailand's Brand Ambassador and Honorary Tourism Advisor?
What is India's position in the World Happiness Report 2025?
National Housing Bank (NHB) and Indian Railway Finance Corporation (IRFC) have raised funds worth a total of ā¹4,500 crore through sales of three-year ...
Which country recently became the first in the world to introduce a tax on livestock carbon dioxide (CO2) emissions starting in 2030?
Where will the 46th session of the UNESCO World Heritage Committee be held?
What is significant about the newly discovered plant species Ceropegia shivrayiana found in the Vishalgad area of Kolhapur?
_______________ was conferred with the Netaji Award 2022 by Netaji Research Bureau on Netaji Subhas Chandra Bose’s 125th birth anniversary.
Which entity has introduced the ABSLI Nishchit Aayush Plan?