Sorting


there are some interesting sort visualizations at https://imgur.com/a/voutF For this lab we will do 3 variants of the bubble sort NO NOT use single leter variables for your loops in this class EVER.. HINT: if you ever do want to use single letter names for your varaibles outside this class l,j,i and o are probably the worst choices possible because they look way to close to 1 and 0 Two test mains have been provided to test your functions, make your output match FOR BOTH examples put your function bodies in the functions.h file File: functions.h

#pragma once
#include "cmpslib19.h"
#include "easylogging++.h"



int Sort1(int *array, int count)
{
	// a basic bubble sort 
// for loop outer ( 0 to N-1)
// for loop inner ( 0 to N-2)
// compare two adjacent items (inner and inner+1) and std::swap if necessary
//    
// use an int to keep track of how many comparisons occur and return it  
// 
// basically requires N squared iterations, always the same 
// log the start , end and the value returned ( look at the example log)

}


int Sort2(int *array, int count)
{
	// for loop outer( 0 to N-1)
// for loop inner( 0 to (starts with N-2 but decrements each time ))
// compare two adjacent items (inner and inner+1) and std::swap if necessary
//
// use an int to keep track of how many comparisons occur and return it  
// basically requires (n(n+1))/2 iterations, always the same
// log the start , end and the value returned ( look at the example log)

} 


int Sort3(int *array, int count)
{
	// same basic logic as Sort2
// add a bool flag "IsSorted" 
// set it true before each pass through the array (inner loop)  
// if during the pass through the array it needs to std::swap, then 
// it is not sorted so set IsSorted to false
// but if a complete pass is made through the array without std::swapping
// IsSorted will still be true then return from the funcion 
//
// use an int to keep track of how many comparisons occur and return it  
// basically <= (n(n+1) / 2  iterations, can vary greatly depending on how unsorted the target is
// log the start , end and the value returned ( look at the example log)

}