Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


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



The element being searched for is not found in an array of 100 elements. What is the average number..

Answer / ntrphanikumar

100 comparisions

since element is not there and the data is unordered we need
to compare with each and every element

Is This Answer Correct ?    50 Yes 7 No

The element being searched for is not found in an array of 100 elements. What is the average number..

Answer / 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 ?    24 Yes 2 No

The element being searched for is not found in an array of 100 elements. What is the average number..

Answer / pavan

100

Is This Answer Correct ?    19 Yes 4 No

The element being searched for is not found in an array of 100 elements. What is the average number..

Answer / mounesh badiger

we have to check all the elements of the array.so average is
n(size of array)

Is This Answer Correct ?    14 Yes 3 No

The element being searched for is not found in an array of 100 elements. What is the average number..

Answer / vidhun s

yes.we need 100 comparisons.

Is This Answer Correct ?    13 Yes 4 No

The element being searched for is not found in an array of 100 elements. What is the average number..

Answer / poonam

IN sequential search (average case =[1/2(best case)+(wrost case)])...its the formula to calculate the average case of sequential search ...
so best case is when we found the element in first comparison.
worst case is when we found element in 100 comparison.
average case is =1/2(1+100)
ans would be 50.5

Is This Answer Correct ?    11 Yes 5 No

The element being searched for is not found in an array of 100 elements. What is the average number..

Answer / siya

100 comparisons

Is This Answer Correct ?    7 Yes 3 No

The element being searched for is not found in an array of 100 elements. What is the average number..

Answer / tek002

The question is asking for the average number of
comparisons, not the particular realization... On average
you need 50 comparisons since the element you are searching
could just as likely be at the end of the array, as in the
beginning of the array. (for a brute force sequential
search)

If you really want to be fancy, you can actually do it with
10 (sqrt(N)) steps. Since a comparison search is an oracle
based search, you can implement the Grover's Algorithm
which is a unsorted database searching algorithm which is
the best known oracle based search for unsorted databases
(in fact is is provably the best oracle based search for
unsorted arrays).

Is This Answer Correct ?    3 Yes 4 No

The element being searched for is not found in an array of 100 elements. What is the average number..

Answer / shailesh pratapwar

The avrage case complexity of any linear search alogrithm is
n/2.
So we need 50 comparisons to search in 100 elements.

Is This Answer Correct ?    1 Yes 2 No

The element being searched for is not found in an array of 100 elements. What is the average number..

Answer / pankaj

(sum of all 1 to 100) - (sum of given numbers)= number missing
for this no comparison required

Is This Answer Correct ?    4 Yes 20 No

Post New Answer

More Data Structures Interview Questions

What is a node in it?

0 Answers  


Define avl tree?

0 Answers  


Explain binary tree traversals?

0 Answers  


What is binary tree example?

0 Answers  


What is the difference between a hashmap and hashtable?

0 Answers  


How do you separate zeros from non-zeros in an array?

0 Answers  


What is a tech stack?

0 Answers  


Why do we use insertion sort?

0 Answers  


Why is quicksort unstable?

0 Answers  


Why do we need searching algorithms?

0 Answers  


Differentiate file structure from storage structure?

0 Answers  


What does sorting an array do?

0 Answers  


Categories