Question
What is the best-case time complexity of the binary
search algorithm ?Solution
The best-case time complexity of the binary search algorithm is O(1), which occurs when the target element is found at the middle index on the very first comparison. Binary search divides the array into two halves and compares the middle element with the target. If the middle element matches the target, the search terminates immediately, requiring only one comparison. This efficiency makes binary search a powerful tool for sorted data. Why Other Options Are Incorrect :
- O(n) : This is the time complexity of linear search, where each element is compared sequentially. Binary search is much faster than linear search for sorted data.
- O(log ā” n) : This is the average and worst-case time complexity of binary search, not the best case.
- O(n2) : This is the complexity of algorithms like bubble sort or selection sort, not binary search.
- O(nlog ā” n) : This is the complexity of efficient sorting algorithms like merge sort, not binary search.
Consider the statements about INS Chennai:
1. Indian Navy recently responded to a hijacking attempt on vessel MV Lila Norfolk.
2. It is th...
Which technology is NOT mentioned as part of Indiaās upgraded Multi-Agency Centre (MAC)?
Consider the following statements about AUKUS Initiative:
1.Ā It is a strategic partnership among Australia, the United Kingdom (UK), and the Un...
Rajesh Kumar has been appointed as the new:
What is the revised additional capital buffer requirement for SBI starting April 1, 2025, as per the RBIās D-SIB framework?
Which of the following abolished the '36 Rakam 32 kalam' tax system?
SASTRA Ramanujan Prize, recently seen in the news, is awarded for the contribution in:
Which international organization recently partnered with the ENGIE group to build a 400-megawatt solar photovoltaic power plant in Gujarat?
Who has been appointed as the chairman of Mastercard India in a non-executive advisory role?
What was the net Foreign Direct Investment (FDI) in India for the first quarter of the financial year 2023-24 (April-June), compared to the same period ...