CSC 313 DMa Sructures Esam 3 Fell 21016 1 for - 1ton- 1 do while s end e end Fig
ID: 3716292 • Letter: C
Question
CSC 313 DMa Sructures Esam 3 Fell 21016 1 for - 1ton- 1 do while s end e end Figure 2: Insertion sor 19. (3pts) The partitio n algorithm in Figure I has a missing line idotted tine). Choose the cotrect B. While ?Lil pilot C. Ifa pivot D. While afil E ivod 20. (3pts) The code for insention sort is shown in Figure 2. For a given value of i how many times is line 6 executed when the input is already sorted? B. I C, i D. 2i (3pts) The code for insertion sort is shown in Figure 2. For a given value of i how many times is line 6 executed when the input is sorted in reverse? 21. A, o B. 1 D. 2iExplanation / Answer
19. Figure 1 missing
20. when sorted array is given to the insertion sort, it won't go to the inner loop. So, line number 6 never executed.
21. when reverse sorted array is given to the insertion sort, it will check the inner loop i times, so the line number 6 is executed i times.
[NOTE: Please upload quality images]