GATE | GATE CS Mock 2018 | Question 57
Given A, an array of size n, comprised of an increasing sequence of numbers followed immediately by a decreasing one. What is worst case time complexity of optimal algorithm to determine if a given number x is in the array?
(A) Θ(log n)
(D) Θ(log n)^2
Explanation: This is an application of Binary search, which has time complexity Θ(log n) in worst case.
Option (A) is correct.
Quiz of this Question
Level Up Your GATE Prep!
Embark on a transformative journey towards GATE success by choosing Data Science & AI
as your second paper choice with our specialized course. If you find yourself lost in the vast landscape of the GATE syllabus, our program is the compass you need.