The order of the binary search algorithm is ______.
2024
The order of the binary search algorithm is ______.
- A.
N
- B.
N log n
- C.
N2
- D.
More than one of the above
- E.
None of the above
Attempted by 231 students.
Show answer & explanation
Correct answer: E
Binary search works by repeatedly dividing the sorted array in half and checking the middle element. At each step, the search space is reduced by half. The number of steps required to find the target element is proportional to the number of times you can divide N by 2 until you reach 1. This is log₂N, so the time complexity is O(log N).
हिन्दी उत्तर: बाइनरी सर्च एक विभाजन आधारित एल्गोरिद्म है जो एक सॉर्टेड एरे को आधे में विभाजित करता है और मध्य तत्व की जाँच करता है। प्रत्येक चरण में, खोज क्षेत्र आधा हो जाता है। लक्ष्य तत्व को खोजने के लिए आवश्यक चरणों की संख्या N को 2 से विभाजित करने की संख्या के अनुपात में होती है जब तक कि 1 न हो जाए। यह log₂N है, इसलिए समय जटिलता O(log N) है।