Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


What is the average number of comparisons needed in a
sequential search to determine the position of an element in
an array of 100 elements, if the elements are ordered from
largest to smallest?

Answers were Sorted based on User's Feedback



What is the average number of comparisons needed in a sequential search to determine the position o..

Answer / saurav

i dont think the above answer is correct..it should be (N+1)/2
according to me..if my answer is not correct,can anyone
explain me the reason..

Is This Answer Correct ?    54 Yes 4 No

What is the average number of comparisons needed in a sequential search to determine the position o..

Answer / wonder

Avarage number of comparision will be (N+1)/2(N-size of
array).
Because:If elements is in 1st position no of cpmparision
will be one and if the element is in the last position then
no of comparisions will be N.

Is This Answer Correct ?    31 Yes 0 No

What is the average number of comparisons needed in a sequential search to determine the position o..

Answer / punit

(n+1)/2
saurav is right.

Is This Answer Correct ?    28 Yes 1 No

What is the average number of comparisons needed in a sequential search to determine the position o..

Answer / nilavalagan

The element may be found at any place in the array.

Supposing that the element is in 1st position, no.of comparison = 1;
Element is in 2nd position, no.of comparison = 2;

In the same way,
for the element present in 100th positionn no.of comparison = 100;

Total no.of comparison = 1+2+3+....+100

Average no.of comparison = (1+2+3+..+100)/100

= (100*101)/2*100
(Remember n(n+1)/2)
=101/2 = 50.5

In general = (n+1)/2; if there are n elements.

Is This Answer Correct ?    15 Yes 0 No

What is the average number of comparisons needed in a sequential search to determine the position o..

Answer / sabir

(n+1)/2

Is This Answer Correct ?    13 Yes 1 No

What is the average number of comparisons needed in a sequential search to determine the position o..

Answer / tej pratap

it should be (100+1)/2.

Is This Answer Correct ?    12 Yes 3 No

What is the average number of comparisons needed in a sequential search to determine the position o..

Answer / shyam

see
http://www.cs.odu.edu/~cmo/classes/msim602/studyGuide/ch10.doc.

for details..

the fact that the array is already sorted does not affect
the number of comparisons ..

Is This Answer Correct ?    6 Yes 2 No

What is the average number of comparisons needed in a sequential search to determine the position o..

Answer / dj

Answer is log n (base 2), Maximum camparision required to
search the array of 100 elments is 8. ( modified binary
search)

Is This Answer Correct ?    10 Yes 7 No

What is the average number of comparisons needed in a sequential search to determine the position o..

Answer / sherin

its asked sequential search
if it was binary then dividing array into 2 , then
comparing....100 - 50 - 25 - 12 - 6 - 3 - 1 -then the no.,
i think Dj thought it like that ..

Sequential search is not needed here because the numbers are
ordered , if it was not ordered then 'n' comparisons are
necessary.

question here is not worst case scenario , see its asked
average case ..that too with ordered numbers ...

Is This Answer Correct ?    4 Yes 1 No

What is the average number of comparisons needed in a sequential search to determine the position o..

Answer / amit

(n+1)/2
here n= 100
so (100+1)/2
then 50.5 answer

Is This Answer Correct ?    2 Yes 0 No

Post New Answer

More Data Structures Interview Questions

Which is the parent class of abstractqueue class?

0 Answers  


Which data structures are used in bfs and dfs algorithm?

0 Answers  


Is quicksort divide and conquer?

0 Answers  


Is Linked List 'linear' or 'Non-linear' data structure?

1 Answers   Accenture,


Where is insertion sort used?

0 Answers  


For addition and deletion. Which one is most preferred: array list or linked list?

0 Answers  


Can you declare an array without assigning the size of an array?

0 Answers  


Give us a program to reverse a linked list.

0 Answers   DELL, Genpact,


In which matrix, we can use multilinked structures?

0 Answers  


Differentiate between iterator and enumeration.

0 Answers  


What are different dynamic memory allocation technique in c.

0 Answers  


Differentiate between hashset and hashmap.

0 Answers  


Categories