1 Mark the following statements as true or false A sequentia
Solution
You have posted 12 questions at once. I’m answering the first two full questions - one of which contains two sub-parts and the other one contains 4 sub-parts.
-------------------------------------------------------------------------------------------------------
(1 – (a))
This statement is false.
Explanation: A sequential search simply means that the given element is matched against each of the elements in the list in a sequential manner. It doesn’t require the list to be sorted.
-------------------------------------------------------------------------------------------------------
(1 – (b))
This statement is true.
Explanation: Suppose the task is to search if list contains the element k. Then binary search involves matching the middle element of the list with k. And depending on whether the middle element is greater than or less than k, we eliminate the bottom half or the top half of the list from further matching.
Eliminating half of the list requires us to know whether the top half (or the bottom half) elements are greater than or less than the middle element.
Therefore, the list needs to be sorted.
-------------------------------------------------------------------------------------------------------
(2 – (a))
The list contains 8 elements.
90 is matched against all the 8 given elements in a sequential way (that is one after another). Then it reports that 90 was not found.
So, 8 comparisons are needed.
-------------------------------------------------------------------------------------------------------
(2 – (b))
57 is compared against 3, 45, 32, 98, 46 and 57 in that order. Then it reports that 57 is found.
So, 6 comparisons are needed.
-------------------------------------------------------------------------------------------------------
(2 – (c))
63 is compared against the first element of the list (which is 63) and reports that it is found.
So, only 1 comparison is needed.
-------------------------------------------------------------------------------------------------------
(2 – (d))
120 is compared against all the elements one by one and then reports that it is not found in the list. This is similar to part 2- (a)
So, 8 comparisons are needed.
-------------------------------------------------------------------------------------------------------
If you have any queries regarding the above, please ask in the comments and I will make sure to help you with it.

