Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question 1 Consider an array of elements {1, 2, 3, 4, 5, 6, 7,8}, how many comparisons does it take to sort it using Insertion

Question 1

Consider an array of elements {1, 2, 3, 4, 5, 6, 7,8}, how many comparisons does it take to sort it using Insertion Sort.

a. 7

b. 8

c. 0

d. 14

e. None of the answers

Question 2:

Consider an array of elements {7, 6, 5, 4, 3, 2, 1}, how many comparisons does it take to sort it using Selection Sort?

a. 6

b. 21

c. 7

d. 49

e. None of the answers

Question 3:

Consider an array of element {17, 20, 42, 9, 13, 3, 7, 24}, which two elements will be second compared in a top-down merge sort?

a. {17, 20}

b. {42, 9}

c. {13, 3}

d. {7, 24}

e. None of the answers

Question 4:

Consider the following array: {18,35,42,70, 75,78, 32,98}. Which of the following algorithms has the minimum number of comparisons to sort this array?

a.Selection sort

b.Shell sort

c.Merge Sort

d.Insertion Sort

e.None of the answers

Question 5:

Consider the following array:{7, 2, 10, 15, 9} and consider we want to apply Insertion sort, the first exchange that takes place is between:

a.7 and 2

b.7 and 9

c.2 and 15

d.7 and 15

e.None of the answers

Question 6:

Which of the following algorithms we have seen uses recursion?

a.Selection Sort

b.Insertion Sort

c.Shell Sort

d.Merge Sort

e.None of the answers

Question 7:

Consider the following array: {1, 5, 7, 9, 10, 16, 27}, what is the exact number of exchange operations that will be executed using selection sort algorithm:

a.0

b.1

c.6

d.7

e.None of the answers

Question 8:

Consider the following array: {7, 10, 5, 3, 8, 4, 2, 9, 6}; trace the Selection Sort algorithm and specify the last exchange that occurs between two distinct items:

a.8 and 10

b.7 and 6

c.10 and 2

d.9 and 6

e.None of the answers

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_2

Step: 3

blur-text-image_3

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

Pro PowerShell For Database Developers

Authors: Bryan P Cafferky

1st Edition

1484205413, 9781484205419

More Books

Students also viewed these Databases questions

Question

Discuss how S. Truett Cathys values shaped Chick-fil-As operation.

Answered: 1 week ago

Question

1. Explain why evaluation is important.

Answered: 1 week ago