“C Language” – Counting ‘swaps’ and ‘comparisons’ in a’Selection Sort’ Algorithm Array.
Advice on code required to a) count ‘swaps’, b) ‘comparisons’and c) output result – by editing the following please?
________________
#define SIZE 10
#include
#include
#include
// function prototypes
void selectionSort(int array[], size_t length);
void swap(int array[], size_t first, size_t second);
void printPass(int array[], size_t length, unsigned int pass,size_t index);
int main(void) {
int array[SIZE]; // declare the array of ints to be sorted
srand(time(NULL)); // seed the rand function
for (size_t i = 0; i < SIZE; i++) {
array[i] = rand() % 90 + 10; // give each element a value
}
puts(“Unsorted array:”);
for (size_t i = 0; i < SIZE; i++) {
PayPal Gateway not configured
PayPal Gateway not configured