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 linked list in data structure?
Is treemap thread safe?
how to search an element in sorted linked list with time complexity is O(log n).
Convert following infix expression to the prefix expression. a - b + c * (d / e - (f + g))
33 Answers Amazon, Microsoft, Star Technologies, Sun Microsystems, Wipro,
How do you sort an array in descending order?
What is breadth first tree?
Why do we need to recycle?
What do you mean by double hashing?
What is difference between map and hashmap?
Explain in brief a linked list.
Which data structure is used in arraylist?
1) Program A and B are analyzed and found to have worst- case running times no greater than 150nlog2n and n2 respectively.Answer the folloWing questions if possible.. i) which program has the better guarantee on the running time,for larger values of n(n>10000) ? ii) which program has the better guarantee on the running time,for small values of n(n<100) ? iii) which program will run faster on average for n =1000 2) wRite a program to compute the number of collisions required in a long random sequence of insertions using linear probing ,quadratic probing and double hashing 3) what is the optimal way to compute A1 A2 A3 A4 A5 A6 where the dimensions of the matrices are A1:10*20 A2 : 20 * 1 A3 : 1 * 40 A4 : 40*5 A5 : 5 * 30 A6 : 30 X 15