Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++, Library: #inculde , using namespace std, Show screenshot of answer Write a template function for Bubble sort (pseudocode provided later) that sorts in descending

C++, Library: #inculde , using namespace std, Show screenshot of answer

image text in transcribed

Write a template function for Bubble sort (pseudocode provided later) that sorts in descending order with the following interface template void BubbleSortltemtvpe valuesll, int puoValues) You should write a main function, and invoke the BubbleSort function you write on the following data sets int intArrayll f43, 7, 10, 23, 38, 4, 19, 51, 66, 14 ],; float floatArray] 43.2,7.1, 10.5, 3.9, 18.7, 4.2, 19.3, 5.7, 66.8,14.4]; string strAuraxll-"cat, "dog", "fish", "frog", "bird", "hamster", "gerbil", "monkey", "elephant", "giraffe" Notes: In your main function, you should print out the contents of each of the arrays before and after the sorting algorithm is performed. You may write a separate swap() function to help if you wish o Make sure you put template above that function as well BUBBLESORT PSEUDOCODE procedure Bubblesert(A:list of sortable items) repeat swapped-false for d= 1 to length(A) -1 inclusive do: /* if pair is out of order */ if AL -1] A[j ] then /* swap them and remember something changed */ swap (Ai-1] swapped- true; , A[]); end if end for until not swapped end procedure

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

Advances In Databases And Information Systems 23rd European Conference Adbis 2019 Bled Slovenia September 8 11 2019 Proceedings Lncs 11695

Authors: Tatjana Welzer ,Johann Eder ,Vili Podgorelec ,Aida Kamisalic Latific

1st Edition

3030287297, 978-3030287290

More Books

Students also viewed these Databases questions

Question

3. How frequently do the assessments occur?

Answered: 1 week ago