Skip to content
Related Articles

Related Articles

Improve Article

GATE | GATE CS Mock 2018 | Question 57

  • Last Updated : 03 Jan, 2018

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)
(B) Θ(n)
(C) Θ(n^2)
(D) Θ(log n)^2


Answer: (A)

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

Attention reader! Don’t stop learning now.  Practice GATE exam well before the actual exam with the subject-wise and overall quizzes available in GATE Test Series Course.

Learn all GATE CS concepts with Free Live Classes on our youtube channel.

My Personal Notes arrow_drop_up
Recommended Articles
Page :