   Chapter 11.3, Problem 26ES ### Discrete Mathematics With Applicat...

5th Edition
EPP + 1 other
ISBN: 9781337694193

#### Solutions

Chapter
Section ### Discrete Mathematics With Applicat...

5th Edition
EPP + 1 other
ISBN: 9781337694193
Textbook Problem
1 views

# According to Example 11.3.6. the maximum number of comparisons needed to perform insertion sort on an array of length five is 5 2 + 5 − 2 = 28 . Find an array of length five that requires the maximum number of comparisons when insertion sort is applied to it.

To determine

To find the array length five that requires maximum number of total comparisons using algorithm segment.

Explanation

From the given problem

a =5a=4a=1a=3a=2

Initially given 5 elements and 5 is assigned to n. Initially set k to 2, x to a[k]= a=4  and j to k1=21=1 .Here, n=5,k=2,x=4,j=1.

First step to compare j0 the second element 4 which is less than first element 5 ,so need to assign the 7 as the second element and then j is decreased by 1

### Still sussing out bartleby?

Check out a sample textbook solution.

See a sample solution

#### The Solution to Your Study Problems

Bartleby provides explanations to thousands of textbook problems written by our experts, many with advanced degrees!

Get Started 