Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Question 1: Sorting Illustrate the operation of Algorithm INSERTIONSORT on the array 45, 33, 24, 45, 12, 12, 24. How many comparisons are performed by
Question 1: Sorting Illustrate the operation of Algorithm INSERTIONSORT on the array 45, 33, 24, 45, 12, 12, 24. How many comparisons are performed by the algorithm? After Iteration 45 33 24 45 12 12 24 Number of comparisons i = 2 i = 3 i=4 i= 5 i=6 i=7 Number of comparisons Question 2: Given array A = [10, 14, 19, 20, 21, 29, 32, 38, 47], fill the following table to show how BINARYSEARCH finds x. (a) x = 14 Iteration low high Mid Amid vs x 1 2 3 4 high mid Amid] vs X (b) x = 29 Iteration low 1 2 3 4 5 Question 3: Algorithm Analysis (a) How many times is Step 6 executed in the following algorithm? What is the time complexity of the algorithm? 1. count+O 2. for i+ 1 to Llog n] 3. forj i to i + 5 4. for kr 1 to 12 6. count count + 1 7. end for 8. end for 9. end for high mid Amid vs x (e) x = 47 Iteration low 1 2 3 4 5 high mid A mid vs x (d) x = 6 Iteration low 1 2 3 4 5
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started