Question: 1. Consider the following list: 's', 'u', 'b', 'd', 'e', 'r', 'm', 'a', 't','o', 'g', '', 'y', 'p', 'h', '1', 'C' i) Using the sequential


1. Consider the following list: 's', 'u', 'b', 'd', 'e', 'r', 'm', 'a', 't','o', 'g', '', 'y', 'p', 'h', '1', 'C' i) Using the sequential search algorithm, show the steps to find the following items. How many comparisons are required to find whether the items are in the list? a) 'm' b) 'p ii) Using the binary search algorithm, show the steps to find the following items. How many comparisons are required to find whether the tems are in the list? Show the values of first, last and middle and the number of comparisons after each iteration of the loop. a) b) 'p 'c' 2. By using the sequence of numbers stated in Question 1, sort the numbers in ascending order by using the following techniques. i) Insertion Sort. Also, calculate the total number of comparisons have done for the sorting. ii) Selection Sort based on the largest value. Also, calculate the total number of swaps have done for the sorting. iii) Shell Sort (Index of separation: 3, 2, 1). iv) Merge Sort. v) Quick Sort (pivot is the first element). vi) Heap Sort
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
