   Chapter 11.3, Problem 22ES ### 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

# Construct a trace table showing the action of insertion sort on the array of exercise 20.

To determine

Construct a trace table showing the action of insertion sort on the array of exercise 20.

Explanation

Given information:

 a[n] Stored value a 6 a 2 a 1 a 8 a 4

Concept used:

Insertion sort algorithm is used.

Calculation:

The algorithm of insertion sort is

For

k=2 to nx=a[k]J=k1

while(J0)

if x<a[j]

a[J+1]=a[J]J=J1

End if

End while

a[J+1]=x

Next k

In insertion sort algorithm when fort next loop is first inserted k is assigned the value 2

x is assigned the value of a(2) which is 2 and J have the value k1 which is v. since J1 the while loop is entered and the condition for the if-then else statement is tested. Inside the if-then else statement the value of x is compared with a

### 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 