UGC NET Paper 2 (Computer Science)Moderate
The worst-case time complexity of binary search on n sorted elements is:
- A. O(n)
- B. O(n log n)
- C. O(1)
- D. O(log n)
Correct answer: D. O(log n)
Each step halves the search range, so the worst case is O(log n).
Practise more UGC NET Computer Science and Applications questionsUGC NET Computer Science and Applications: notes and key points
More UGC NET Computer Science and Applications questions
- Which normal form removes transitive dependencies?
- The number of edges in a complete undirected graph with n vertices is:
- Belady's anomaly can occur in which page replacement algorithm?
- The recurrence T(n) = 2T(n/2) + n/log n has the solution:
- For T(n) = T(n/2) + T(n/4) + n, the asymptotic solution is:
- The number of structurally distinct binary trees with 5 nodes is: