Question: Total =20 marks (write your answer inside the teutbox. provided, otherwise it will NOT be graded) NOTE: for each question, write exact answer (do NOT
Total =20 marks (write your answer inside the teutbox. provided, otherwise it will NOT be graded) NOTE: for each question, write exact answer (do NOT write in terms of big- O). 1) [2 marks] Answer the following about insertionsort on the given array A={2,9,1,7,3,5,8,4} a. Exactly how many times the outer loop will run? b. Exactly how many times the inner loop will run? 2) [2 marks] Answer the following about InsertionSort on the given array A={2,5,6,8,9,3}. a. Exactly how many times the outer loop will run ? b. Exactly how many times the inser loop will run ? 3) [2 marks] Answer the following about lnsertionSont on the given array A{9,8,7,6,5,1}= a. Exactly how many times the outer loop will run ? b. Exactly how many times the inacr loop will nun ? 4) [ 3 marks] Answer the following about original Bubblesort on the given array A={2,5,6,8,9,10} : 3. Exactly how many times the outer loop will run ? b. Exactly how duny times the inner loop will run? c. Exactly how many times the Exchange takes place 7 5) [3 marks] Answer the following about original Bubblesort. on the given array A={9,5,6,8,1,3} : a. Exactly how many times the outer loop will rin ? b. Exactly how many times the inner loop will run? c. Exactly bow many times the Exchange takes place ? 6) [2 marks] Answer the following about modified BubbleSont (with boolean variable swap as discussed in the class) on the given array A={2,4,5,6,1,8}: a. Exactly how many times the outer loop will nun? b. Exactly how many times the inase loop will run? 7) [6 marks] Answer the following if we nan MergeSort en the given array A=[7,6,1,2,9,8,3,5,4,2] a. Total how many times Mergefort will be called. b. Total how many times Merge will be called
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
