The element being searched for is not found in an array of
100 elements. What is the average number of comparisons
needed in a sequential search to determine that the element
is not there, if the elements are completely unordered?

Answers were Sorted based on User's Feedback



The element being searched for is not found in an array of 100 elements. What is the average number..

Answer / anirban lahiri

Allmost 50 comparison's are required. Because if we use
double pointer instead of single pointer and we run the
algo. untill we get that element. But that ele. is not in
that unordered list then the algo will stop and produces
"No match is found", when the pointers are superimpossed to
each other. That is we set an algo. of two pointer's in the
front and rear end and when each time the matching is not
found then one pointer is go on increasing and the other
one is go on decreasing( in location ).

Is This Answer Correct ?    6 Yes 24 No

Post New Answer

More Data Structures Interview Questions

Explain the term binding time?

0 Answers  


What is the difference between length () and size () of arraylist?

0 Answers  


Can you store different types in an array?

0 Answers  


What is the relationship between a queue and its underlying array?

0 Answers  


Define linear probing?

0 Answers  






What is adt in data structure with example?

0 Answers  


Does treemap allow null keys?

0 Answers  


What is hash value of a string?

0 Answers  


Why do we need to use computers to help us sort lists?

0 Answers  


What is ascending and descending order?

0 Answers  


Why do we need a data structure?

0 Answers  


Write the recursive c function to count the number of nodes present in a binary tree.

0 Answers  


Categories