What is the average number of comparisons in a sequential
search?
Answers were Sorted based on User's Feedback
Answer / vivek tiwari
f(n)= 1.Pn + 2.Pn + 3.Pn +...+ N.Pn
where
Pn = 1/N
f(n)= 1.1/N +2.1/N + 3.1/N+....+N.1/N
= (1+2+3+....+N)1/N
= N(N+1)/2N
= (N+1)/2
| Is This Answer Correct ? | 47 Yes | 1 No |
Answer / bipin from utkal university mc
suppose there are five element 23,56,78,12,90
minimum time require means searching element present at
first so it takes only one comparison
maximum time require means searching element present at
last so it takes n No. of comparison(here 5 )
so avarage comarison=(1+n)/2
| Is This Answer Correct ? | 10 Yes | 1 No |
Answer / kalyani
Searching an element in an array, the search starts from the first element till the last element the average number of comparisons in a sequential search is (N+1)/2,where N is the size. The number of comparisons will be 1, if element is in the first position and if element is in the last position the number of comparisons will be N.
| Is This Answer Correct ? | 0 Yes | 0 No |
What is m way tree in data structure?
Are the expressions arr and &arr same for an array of integers?
Why is hashmap faster than treemap?
What is numeric array?
What should be done in the base case for this recursive problem?
What is static array?
If we add enum constants to a sorted collection ( treemap , treeset ), what will be the order in which they will be maintained?
Why do we need sorting?
Differentiate linear from non linear data structure?
How do arrays work?
Which is better hashmap or hashtable?
What is the maximum total number of nodes in a tree that has N levels? Note that the root is level (zero)
18 Answers CSC, National Instruments, Sasken, Sybrant Technologies,