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
Can hashmap have duplicate keys?
Explain singly linked list in short.
Why is quicksort unstable?
What are sorting algorithms used for?
Why do we need linked list?
Which data structure is applied when dealing with a recursive function?
What method is used to place a value onto the top of a stack?
What do you mean by level of the tree?
What is the Role of push() and pop() method?
What is return map?
Write program for Quick sort ?
Define ancestor and descendant ?
What do you mean by recursive definition?
Calculate the address of a random element present in a 2d array, given base address as ba.
an array of size N in which every number is between 1 and N, determine if there are any duplicates in it. You are allowed to destroy the array if you like. [ I ended up giving about 4 or 5 different solutions for this, each supposedly better than the others ].