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?
Answer Posted / 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 View All Answers
What do you mean by general trees?
What is the purpose of tochararray ()?
Is data structure a data type?
Why do we use hashset?
What is Insertion sort, selection sort, bubble sort( basic differences among the functionality of the three sorts and not the exact algorithms)?
Can we remove element from arraylist while iterating?
What is a multiset table?
What is nonlinear data?
Which is the parent class of list
What member function places a new node at the end of the linked list?
What are priority queues?
What is the use of heap sort?
What is meant by linked list?
What is the difference between a hashmap and hashtable?
Explain set interface?