Solveeit Logo

Question

Computer Science Question on Searching

Choose the statements that are correct.
Options:
(A) For Binary Search, all the elements have to be sorted.
(B) For Linear Search, all the elements have to be sorted.
(C) Linear Search takes less time for searching in worst case than binary search’s worst case.
(D) Linear Search always gives fast result whether elements are sorted or not.
Choose the correct answer from the options given below:

A

(A) only

B

(A) and (C) only

C

(B) and (C) only

D

(A), (B), and (D) only

Answer

(A) and (C) only

Explanation

Solution

Binary search works only on sorted data, with a worst-case complexity of O(log n). Linear search handles unsorted data but has O(n) complexity in the worst case.