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
How does a hashmap work?
Explain in brief a linked list.
Why hashmap is faster than hashset?
Which is faster hashmap or hashset?
How many times is merge sort called?
Define linear data structures?
Which sort is stable?
Can we modify final arraylist?
Mention for which header list, you will found the last node contains the null pointer?
Is int a data structure?
How does selection sort work?
When ArrayIndexOutOfBoundsException occurs?
If you have to store one lakh objects, what will be a better option- a hash map or an array list?
What is vector and types of vector?
Which sorting is best?