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
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 |
What is map data structure?
What is difference between hashtable and hashmap?
What is time complexity of bubble sort?
Sorting is not possible by using which of the following methods? (a) Insertion (b) Selection (c) Exchange (d) Deletion
Evaluate the following prefix expression " ++ 26 + - 1324" (Similar types can be asked)
Why enum can not be used directly with printf function?
In tree construction which is the suitable efficient data structure?
What is raid (redundant array of inexpensive disks)? Explain its level?
What is red black tree in data structure?
Why is hashset not ordered?
Explain about the types of linked lists
What is the difference between arraylist and hashmap?