I am given a sequential algorithm that does a routine search
on an unordered list. N = 20.
The probability that the value x does NOT appear in the list
is exactly 60%, and the probability that x DOES appear is 40%.
The 3 questions that I could not get were:

A) What is the avg number of element comparisons performed
when n = 20 and x does NOT appear in the List.
(my answer was 20, is this correct?)

B) What is the avg number of element comparisons peformed
when n = 20 and x DOES appear in the list?

C) What is the avg number of element comparisons performed
when n = 20. This should be a single number answer they said.

Answer Posted / bond

A) What is the avg number of element comparisons performed
when n = 20 and x does NOT appear in the List. (my answer
was 20, is this correct?)

è I guess 12.

B) What is the avg number of element comparisons peformed
when n = 20 and x DOES appear in the list?

è I guess 8.

C) What is the avg number of element comparisons performed
when n = 20. This should be a single number answer they
said.

è I guess 8.

Is This Answer Correct ?    5 Yes 10 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to compare Two Arrays?

533


What is linked list with example?

490


what are the applications that use Linked lists?

506


What is 1d array?

459


Define threaded binary tree. Explain its common uses

487






What is a circular singly linked list?

495


What are the types of linked list?

497


What is unmodifiable list?

506


Explain pre-order and in-order tree traversal.

531


In tree construction which is the suitable efficient data structure?

541


What is sorting and classifying?

482


What do you mean by open addressing?

520


Which sorting algorithm is considered the fastest?

587


How many types of lists are there?

515


Is arraylist reference type?

458