Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

write Cplus program for exercise 10 on page 636 of your book. 10. Sorting Orders Write a program that uses two identical arrays of eight

write Cplus program for exercise 10 on page 636 of your book.

10. Sorting Orders Write a program that uses two identical arrays of eight integers. It should display the contents of the rst array, then call a function to sort it using an ascending order bubble sort, modied to print out the array contents after each pass of the sort. Next the program should display the contents of the second array, then call a function to sort it using an ascending order selection sort, modied to print out the array contents after each pass of the sort.

Please use the data in the test case and display all intermediate values for the array as you go through each pass as shown below:

Bubble Sort The unsorted values are: 7 2 3 8 4 5 6 1 sort pass #1 : 2 7 3 8 4 5 6 1 sort pass #2 : 2 3 7 8 4 5 6 1 sort pass #3 : 2 3 7 4 8 5 6 1 sort pass #4 : 2 3 7 4 5 8 6 1 sort pass #5 : 2 3 7 4 5 6 8 1 sort pass #6 : 2 3 7 4 5 6 1 8 sort pass #7 : 2 3 4 7 5 6 1 8 sort pass #8 : 2 3 4 5 7 6 1 8 sort pass #9 : 2 3 4 5 6 7 1 8 sort pass #10 : 2 3 4 5 6 1 7 8 sort pass #11 : 2 3 4 5 1 6 7 8 sort pass #12 : 2 3 4 1 5 6 7 8 sort pass #13 : 2 3 1 4 5 6 7 8 sort pass #14 : 2 1 3 4 5 6 7 8 sort pass #15 : 1 2 3 4 5 6 7 8 The sorted values are: 1 2 3 4 5 6 7 8 Selection Sort The unsorted values are: 7 2 3 8 4 5 6 1 sort pass #1 : 1 2 3 8 4 5 6 7 sort pass #2 : 1 2 3 8 4 5 6 7 sort pass #3 : 1 2 3 8 4 5 6 7 sort pass #4 : 1 2 3 4 8 5 6 7 sort pass #5 : 1 2 3 4 5 8 6 7 sort pass #6 : 1 2 3 4 5 6 8 7 sort pass #7 : 1 2 3 4 5 6 7 8 The sorted values are: 1 2 3 4 5 6 7 8 

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

Databases A Beginners Guide

Authors: Andy Oppel

1st Edition

007160846X, 978-0071608466

More Books

Students also viewed these Databases questions

Question

How do Dimensional Database Models differ from Relational Models?

Answered: 1 week ago

Question

What type of processing do Relational Databases support?

Answered: 1 week ago

Question

Describe several aggregation operators.

Answered: 1 week ago