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 / tarzan

Answer i think is

u require 1,2,3,...,100(max) to search an element because it
is unsorted
i assume it to be random seq of number so we hav to search
until we find the required no
so if all input ie search request is a hit then avg is
50.5=~51 (1+2+..+100/(2*100))
and if search has misses den worst is de case i.e mean will
shift towards 100 but always less than 100 bcoz it is
unrealistic to say de search is alwayz miss

Is This Answer Correct ?    23 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How do you sort large data?

581


What is garbage collection in data structure?

492


What is the difference between list and arraylist?

451


What do you mean by sorting?

448


What is heap tree in data structure?

490






What is difference between for loop and foreach?

472


Are collections thread safe?

458


Is queue fifo or lifo?

480


Difference between calloc and malloc ?

529


Why heap sort is not used?

476


what is Linked lists?

603


What is the use of heap sort?

459


Is array size dynamic or fixed?

494


What do you mean by union-by-weight?

571


What are the advantage of collection classes over arrays?

523