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

Name few classes that implement collection interface?

0 Answers  


If you do not initialize an array what will happen?

0 Answers  


What are the basic operations of stack?

0 Answers  


How does variable declaration affect memory allocation?

0 Answers  


State the rules to be followed during infix to postfix conversions?

0 Answers  


What’s the difference between enumeration and iterator interfaces?

0 Answers  


How does a selection sort work?

0 Answers  


Mention some drawbacks of the linked list.

0 Answers  


What are the two traversal strategies used in traversing a graph?

0 Answers  


Define internal nodes?

0 Answers  


Which is the parent class of linkedlist class?

0 Answers  


What are the disadvantages of sequential storage?

0 Answers  


Categories