# (Solved) : Refer Following Array Problems 1 2 Top Row Shows Array Index Bottom Row Data Value Problem Q42740041 . . .

Refer to the following array for problems 1 and 2. The top row shows the array index, and the bottom row is the data value. For these problems, “comparison” means that you access or examine a data value to see if it is the search item. | | Index Value 0 14 | [11] [12] | 3 | 4 | 5 27 | 29 | 38 | 42 | 55 6 57 7 | 18 19 | [10] [11] [12] 61 | 64 | 69 | 70 | 79 | 84 1. How many comparisons are needed to find the value 77 using sequential search? 2. (a) Fill in the table below showing the operation of binary search to find the value 64 in the array shown above. I have filled in the first iteration for you. You can look at the demo on slide 12 of the Topic 7 Part B the slides. NOTE: There may be more rows in the table than you need to complete the search. Comparison Item Found? Iteration First 1 0 Last 12 Middle (0+12)/2=6 77>57 No (b) How many comparisons were needed to find the value 77? B. Sorting Algorithms. For each of the sorting algorithms specified, you will show how the algorithm works on the given data set. As you work through each sort, KEEP TRACK OF THE NUMBER OF SWAPS THAT ARE MADE BY THE ALGORITHM. BE SURE THAT YOU COUNT ALL SWAPS! See the lecture slides online for more information. 3. Selection Sort. (a) For the data below, show the order of the data in the array at the end of each iteration of selection sort. Circle the items that are swapped in each iteration. I have filled in the first iteration for you. NOTE: There may be more columns in the table than you need to complete the sort. 2 3 4 5 6 | 7 8 Iteration [0] [1] [2] Start 60 19 28 22 30 15 5 1 5 1 9 28 22 30 15 C60 [3] [4] [5] [6] (b) How many swaps were needed to sort the array? 4. Bubble Sort. (a) For the data below, show how the first item is sorted using bubble sort. Circle the items being compared for that “check.” I have filled in the first swap for you. There are no extra columns in the table. Check 2 Start 60 19 Check 1 60 Check 3 [O] [O] [1] [0] [1] Check 4 [0] [1] 19 | 28 [O] [1] | [2] [3] [4] [2] [2] [3] 3] 30 IS 141 22 3r 22 [4] 14 (b) How many swaps were needed to sort the first item? Show transcribed image text Refer to the following array for problems 1 and 2. The top row shows the array index, and the bottom row is the data value. For these problems, “comparison” means that you access or examine a data value to see if it is the search item. | | Index Value 0 14 | [11] [12] | 3 | 4 | 5 27 | 29 | 38 | 42 | 55 6 57 7 | 18 19 | [10] [11] [12] 61 | 64 | 69 | 70 | 79 | 84 1. How many comparisons are needed to find the value 77 using sequential search? 2. (a) Fill in the table below showing the operation of binary search to find the value 64 in the array shown above. I have filled in the first iteration for you. You can look at the demo on slide 12 of the Topic 7 Part B the slides. NOTE: There may be more rows in the table than you need to complete the search. Comparison Item Found? Iteration First 1 0 Last 12 Middle (0+12)/2=6 77>57 No (b) How many comparisons were needed to find the value 77?
B. Sorting Algorithms. For each of the sorting algorithms specified, you will show how the algorithm works on the given data set. As you work through each sort, KEEP TRACK OF THE NUMBER OF SWAPS THAT ARE MADE BY THE ALGORITHM. BE SURE THAT YOU COUNT ALL SWAPS! See the lecture slides online for more information. 3. Selection Sort. (a) For the data below, show the order of the data in the array at the end of each iteration of selection sort. Circle the items that are swapped in each iteration. I have filled in the first iteration for you. NOTE: There may be more columns in the table than you need to complete the sort. 2 3 4 5 6 | 7 8 Iteration [0] [1] [2] Start 60 19 28 22 30 15 5 1 5 1 9 28 22 30 15 C60 [3] [4] [5] [6] (b) How many swaps were needed to sort the array? 4. Bubble Sort. (a) For the data below, show how the first item is sorted using bubble sort. Circle the items being compared for that “check.” I have filled in the first swap for you. There are no extra columns in the table. Check 2 Start 60 19 Check 1 60 Check 3 [O] [O] [1] [0] [1] Check 4 [0] [1] 19 | 28 [O] [1] | [2] [3] [4] [2] [2] [3] 3] 30 IS 141 22 3r 22 [4] 14
(b) How many swaps were needed to sort the first item?

Answer to Refer to the following array for problems 1 and 2. The top row shows the array index, and the bottom row is the data val…

We are the best freelance writing portal. Looking for online writing, editing or proofreading jobs? We have plenty of writing assignments to handle.