What is the average number of comparisons needed in a
sequential search to determine the position of an element in
an array of 100 elements, if the elements are ordered from
largest to smallest?
Answer Posted / wonder
Avarage number of comparision will be (N+1)/2(N-size of
array).
Because:If elements is in 1st position no of cpmparision
will be one and if the element is in the last position then
no of comparisions will be N.
| Is This Answer Correct ? | 31 Yes | 0 No |
Post New Answer View All Answers
What is the height of binary tree?
What is difference between array and arraylist? When will you use array over arraylist?
Why using cookie to store session info is a better idea than just using session info in the request?
Which interfaces are implemented by linkedlist?
Which language is best for data structures?
what is traversal in linked lists?
Is vector synchronized?
What method removes the value from the top of a stack?
Why it is important to have aligned addresses? What is the exception generated when there is a misaligned address?
How many pointers are necessary to implement a simple linked list?
In what data structures are pointers applied?
Why sorting algorithms are important?
What is advantage and disadvantage of linked list?
What is data and data types?
an array of size N in which every number is between 1 and N, determine if there are any duplicates in it. You are allowed to destroy the array if you like. [ I ended up giving about 4 or 5 different solutions for this, each supposedly better than the others ].