##### what is time complexity for the question ?

what is time complexity for the question ?

->if we take odd eg:7(index starts from 0-7)

for min we have to do 6 comparision and for max as well.so it will 12.

but none of the answer is matching ????

what is time complexity for the question ?

->if we take odd eg:7(index starts from 0-7)

for min we have to do 6 comparision and for max as well.so it will 12.

but none of the answer is matching ????

Apply divide and conquer approach to find minimum no. of comparisons.

T(n) = 0, if n=0 (only one element is present)

= 1, if n=2 (if only two elements are present )

= floor[T(n/2)] + ceil[T(n/2)] + 2, otherwise .

If you will solve the recursion, you will get 3n/2 - 2 as the answer.