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
Can we insert null in list?
What is bubble sort in data structure?
State the difference between primitive and non-primitive data types?
Describe avl tree or height balanced binary search tree.
How do you find the number of comparisons in bubble sort?
What is a stable sorting algorithm?
Which is better hashset or treeset?
Why linked list is required?
Define 2-3-4 tree?
Where will be the free node available while inserting a new node in a linked list?
What is the use of data structure?
What is perfect binary tree?
If you are using c language to implement the heterogeneous linked list, what pointer type should be used?
Mention the steps to insert data at the starting of a singly linked list?
What is the difference between null and void?