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
What is meant by heap sort?
What are the different types of hash functions?
write a code for Implementation of stack and queues.
Run time memory allocation is known as ?
What is meant by balanced binary tree?
When would you use a hashmap?
What are the advantages of binary search over linear search?
What is the top of a stack?
What is dynamic array with example?
What is 1d array?
Do sets allow duplicates?
What are the disadvantages of representing a stack or queue by a linked list?
Which sorting algorithm is best for large data?
How to traverse data in a linked list in forward and backward direction, write the algorithm?
Why you need a data structure?