Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

5. Consider the following list of numbers 38, 60, 43, 5, 70, 58, 15, 10 Using th

ID: 3881054 • Letter: 5

Question

5. Consider the following list of numbers 38, 60, 43, 5, 70, 58, 15, 10 Using the version of the selection sort algorithm presented in class display the new contents of the array after each iteration of the outer loop. The number of columns should be exactly what you need. a. What is the total number of item comparisons made? Initial Iteration 1 Iteration 2 Iteration 3 Iteration 4 Iteration 5 Iteration 6 Iteration 7 38 60 43 70 58 15 10 b. Using the version of the bubble sort algorithm presented in class display the new contents of the array after each iteration of the outer loop. The number of rows should be what you need.. What is the total number of item comparisons made? Initial Pass 1 Pass 2 Pass 3 Pass 4 Pass 5 Pass 6 Pass 7

Explanation / Answer

5) a)

The total number of comparisons made are 28 .

Initial

Iteration1

Iteration2

Iteration3

Iteration4

Iteration5

Iteration6

Iteration7

38

5

5

5

5

5

5

5

60

60

10

10

10

10

10

10

43

43

43

15

15

15

15

15

5

38

38

38

38

38

38

38

70

70

70

70

70

43

43

43

58

58

58

58

58

58

58

58

15

15

15

43

43

70

60

60

10

10

60

60

60

60

70

70

b)

The total number of comparisons made are 28 .

Initial

38   

60

43

5

70

58

15

10

Pass1

38

43

5

60

58

15

10

70

Pass2

38

5

43

58

15

10

60

70

Pass3

5

38

43

15

10

58

60

70

Pass4

5

38

15

10

43

58

60

70

Pass5

5

15

10

38

43

58

60

70

Pass6

5

10

15

38

43

58

60

70

Pass7

5

10

15

38

43

58

60

70

6) a)

The total number of comparisons made are 45 .

Initial

Iter1

Iter2

Iter3

Iter4

Iter5

Iter6

Iter7

Iter8

Iter9

46

5

5

5

5

5

5

5

5

5

8

8

8

8

8

8

8

8

8

8

5

46

46

16

16

16

16

16

16

16

25

25

25

25

25

25

25

35

35

35

83

83

83

83

83

46

46

46

46

46

98

98

98

98

98

98

58

58

58

58

16

16

16

46

46

83

83

62

62

62

70

70

70

70

70

70

70

70

70

70

58

58

58

58

58

58

98

98

83

83

62

62

62

62

62

62

62

83

98

98

b)

The total number of comparisons made are 45 .

Initial

46

8

5

25

83

98

16

70

58

62

Pass1

8

5

25

46

83

16

70

58

62

98

Pass2

5

8

25

46

16

70

58

62

83

98

Pass3

5

8

25

16

46

58

62

70

83

98

Pass4

5

8

16

35

46

58

62

70

83

98

Pass5

5

8

16

25

46

58

62

70

83

98

Pass6

5

8

16

25

46

58

62

70

83

98

Pass7

5

8

16

25

46

58

62

70

83

98

Pass8

5

8

16

25

46

58

62

70

83

98

Pass9

5

8

16

25

46

58

62

70

83

98

Initial

Iteration1

Iteration2

Iteration3

Iteration4

Iteration5

Iteration6

Iteration7

38

5

5

5

5

5

5

5

60

60

10

10

10

10

10

10

43

43

43

15

15

15

15

15

5

38

38

38

38

38

38

38

70

70

70

70

70

43

43

43

58

58

58

58

58

58

58

58

15

15

15

43

43

70

60

60

10

10

60

60

60

60

70

70

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote