Question: Write a C++ program that Take 10 integer inputs from user storing them in an array then: > Sorting the array in ascending order

Write a C++ program that Take 10 integer inputs from user storing

Write a C++ program that Take 10 integer inputs from user storing them in an array then: > Sorting the array in ascending order using Bubble sort : Write functions Bubble sort & Swap functions using pointer approach. The Bubble sort function should decrease number of comparisons every pass, make N-1 comparisons on the second pass, N-2 on the third pass, and so on. A Sample of output as follow: Data items in original order 90 30 60 20 8 40 65 3 36 87 After pass 0: 30 60 20 8 40 65 3 36 87 90 After pass 1: 30 20 8 40 60 3 36 65 87 After pass 2: 20 8 30 40 3 36 60 65 After pass 3: 8 20 30 3 36 40 60 After pass 4: 8 20 3 30 36 40 8 3 20 30 36 3 8 20 30 3 8 20 After pass 5: After pass 6: After pass 7: After pass 8: 38 Data items in ascending order 3 8 20 30 36 40 60 65 87 90 Number of comparisons = 45 Press any key to continue...

Step by Step Solution

3.40 Rating (159 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

include include usingnamespacestd voidSwapintxinty int temp temp x x y y temp intBu... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Algorithms Questions!