Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Information Modeling And Relational Databases

Authors: Terry Halpin, Tony Morgan

2nd Edition

0123735688, 978-0123735683

More Books

Students also viewed these Databases questions

Question

What is an event and what is an elementary business process (EBP)?

Answered: 1 week ago

Question

2. What process will you put in place to address conflicts?

Answered: 1 week ago