Question: This is an example of how it needs to be worked out.. The instructor wants the a nswer to be in this format. 2. Illustrate


This is an example of how it needs to be worked out.. The instructor wants the answer to be in this format.
2. Illustrate Selection Sort Algorithm on the data as given below. (15 points) 34, 10, 0, 17, 6,2 What will be the runtime (no formula should be used for computing the runtime. Get the value by counting in each step 1 runtime Explanation of Algorithms A[1] 4. Illustrate Insertion Sort on the following data set, and compute the runtime as well. 37, 18, 49, 40, 67, 42, 25 Ans. 1 1 2 3 4 5 6 7 runtime Explanation of Algorithms A[0] 37 18 49 40 67 42 25 1 A[1] > key, move A[1] to key A[2]'s place. No more data. So move key to 1st place. 18 37 49 40 67 42 25 1 A[2] > key, no. stop key 18 37 49 40 67 42 25 2 49>40, move 49 to 4th key place 37 > 40, stop, Move key to 3rd place. 18 37 40 49 67 42 25 1 49 > 67 stop key 18 37 40 49 67 42 25 3 67 > 42 move 67 key 49 > 42 move 49 40 > 42, stop, move key to 4th place 18 27 40 42 49 67 25 6 18 25 27 40 42 49 67 sorted. Total runtime = 14
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
