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.
Select the correct passive form of the given sentence.
This institute is offering a new online course in Entrepreneurship.
By whom was this window pane broken?
The hanging of the murderer of Mrs Gandhi was seen by many.
Select the correct passive/active form of the given sentence.
The Yadav has built up a big empire.
In the following question a sentence has been given in its active/passive form followed by 5 alternatives. choose the option which is the correct chang...
The sentence has been given in Active/Passive Voice. Change the voice to Passive/Active.
Her answer surprised the guests
Select the correct Active/Passive form of the given sentence-
Mohan will write a book ?
Select the correct active form of the given sentence.
The excitement aroused by the murder was soon forgotten by people.
Choose the option that is the passive form of the sentence.
They considered it an impressive building.
- Select the option that expresses the given sentence in active voice.
The documents were not signed by the manager.
...