Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please do problem1 - part (c) Note: For this assignment, the word comparison refers only to comparisons involving list elements. For example, if ai and

image text in transcribedimage text in transcribed

please do problem1 - part (c)

Note: For this assignment, the word "comparison" refers only to comparisons involving list elements. For example, if ai and a are list elements in a list of length n, the code if ai aj performs one comparison. Similarly, the code if ai 5 performs one comparison. However, we would say the code if i n performs no comparisons because it is not making a comparison involving a list element. 1. For this problem, consider the following sorting algorithms procedure Sort A(a1, a2,... an: a list of real numbers with n 2 for 2 ton 3. while aj a i:- i 1 6. for k 0 to j -i-1 aj-k F k-1 procedure SortB(a1,az,..., an: a list of real numbers with n 2 1. for j 2 to n 3. while (i> 1 AND aj ai-1) 6. for k 0 to j -i-1 k-1 (a) (2 points) Trace the behavior of SortA on the input list 3,2,5,6,4,1 by filling in the following table. Each row corresponds to the completion of one iteration of the outermost loop. When listing the comparisons done in each iteration, say which two elements are being compared in each comparison (example: 3 vs. 5). After the What the list looks like I Comparisons done l Total number of comparisons done so far in this iteration 0th iteratiom 3.25.6.4.1 none iteration 2nd iteration

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

Pro Database Migration To Azure Data Modernization For The Enterprise

Authors: Kevin Kline, Denis McDowell, Dustin Dorsey, Matt Gordon

1st Edition

1484282299, 978-1484282298

More Books

Students also viewed these Databases questions

Question

A firms conversion costs are equal to the ________ and labor costs

Answered: 1 week ago

Question

Know how productivity improvements impact quality and value.

Answered: 1 week ago

Question

Recommend the key methods to improve service productivity.

Answered: 1 week ago