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
Describe tree database.
Which sorting algorithm is considered the fastest?
What is the Insertion Sort Code?.
How is any data structure application is classified among files?
How dynamic arrays are created?
Define 2-3 tree?
Is red black tree balanced?
Write an algorithm to check if there is a loop in a doubly linked list.
What is linked list with example?
Does linked list allow duplicates?
Is duplicate allowed in hashmap?
Write a Program for Insert in a sorted list
What is perfect binary tree?
What is a list of lists?
What is a pass in bubble sort?