Array search

Consider the problem of finding an element \(x\) in an array of size \(n\). In which of the following cases can we find the element \(x\) in \(O(\log n)\) time?

A) Array is sorted.

B) Array is sorted and is rotated by \(k\). The value of \(k\) is known.

C) Array is sorted and is rotated by \(k\). The value of \(k\) is unknown.

D) Array is not sorted.

×

Problem Loading...

Note Loading...

Set Loading...