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 / sherin
its asked sequential search
if it was binary then dividing array into 2 , then
comparing....100 - 50 - 25 - 12 - 6 - 3 - 1 -then the no.,
i think Dj thought it like that ..
Sequential search is not needed here because the numbers are
ordered , if it was not ordered then 'n' comparisons are
necessary.
question here is not worst case scenario , see its asked
average case ..that too with ordered numbers ...
| Is This Answer Correct ? | 4 Yes | 1 No |
Post New Answer View All Answers
Can hashmap be sorted?
Explain the Linked List
Write a recursive c function to calculate the height of a binary tree.
What are the advantages of sorting?
What is meant by ordered and sorted in collections?
What is peek in stack?
Explain the steps to insert data into a singly linked list?
Write a program to sum values of given array.
How to search binary in a sorted array?
Name two algorithms two find minimum spanning tree?
how to insert a new node in linked list where free node will be available?
What is hashing with example?
In what scenario, binary search can be used?
Can we increase the size of statically allocated array?
What are different types of sorting algorithms?