Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Consider running Bubble and Selection Sorts on the two arrays shown below. Write a c program to compute the number of swaps performed on each

Consider running Bubble and Selection Sorts on the two arrays shown below. Write a c program to compute the number of swaps performed on each value and the total number of swaps performed in the following 2 arrays:
array1: 97164563132275872
array2: 908070605040302010
Provide your git repository URL.
The output should have a similar output:
array1:
7: # of times 7 is swapped
13: # of times 13 is swapped
.
.
total # of swaps
array2:
10: # of times 10 is swapped
20: # of times 20 is swapped
.
.
total # of swaps
Please pay attention that the total # swaps is not equal to the sum of the
swaps of each value listed above.
Output should be:
array1 bubble sort:
7: 6
13: 5
16: 3
22: 4
45: 4
58: 2
63: 5
72: 1
97: 8
19
array2 bubble sort:
10: 8
20: 8
30: 8
40: 8
50: 8
60: 8
70: 8
80: 8
90: 8
36
array1 selection sort:
7: 1
13: 1
16: 2
22: 1
45: 1
58: 1
63: 3
72: 1
97: 3
7
array2 selection sort:
10: 1
20: 1
30: 1
40: 1
50: 0
60: 1
70: 1
80: 1
90: 1
4

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

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2015 Porto Portugal September 7 11 2015 Proceedings Part 1 Lnai 9284

Authors: Annalisa Appice ,Pedro Pereira Rodrigues ,Vitor Santos Costa ,Carlos Soares ,Joao Gama ,Alipio Jorge

1st Edition

3319235273, 978-3319235271

Students also viewed these Databases questions