Question: C++ Write a template function for Bubble sort with the following interface: template void BubbleSort(ItemType values[], int numValues) You need to write a main() in

C++

Write a template function for Bubble sort with the following interface:

template

void BubbleSort(ItemType values[], int numValues)

You need to write a main() in which the following data is tested:

int val_array[10] = {43, 7, 10, 23, 18, 4, 19, 5, 66, 14};

float val_array2[10] = {43.2, 7.1, 10.5, 23.9, 18.7, 4.2, 19.3, 5.7, 66.8, 14.4};

int numValues = 10;

In addition, print out the total numbers comparisons and swaps used in the algorithm.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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 Databases Questions!