Data Structures

1:

For a linear search in an array of n elements the time complexity for best, worst and average case are ......., ....... and ........ respectively

A.

O(n), O(1), and O(n/2)

B.

O(1), O(n) and O(n/2)

C.

O(1),O(n) and O(n)

D.

O(1), O(n) and (n-1/2)

 

Answer : C

Explanation :

vikrant said: (5:30pm on Saturday 4th May 2013)
it should be n/2 because it is half of the no;s
kripa said: (11:33am on Thursday 1st October 2015)
then there will not be any difference btween avg case And worst casesince we know theta shows avg case its alwz less then o(n) worst case might be be it can be equal but heresenario says it should be o(n/2)

Write your comments here:


Report Error
 

Option: A

Explanation : Explanation will come here. Explanation will come here. Explanation will come here. Explanation will come here. Explanation will come here.