#include <stdio.h>
#include <time.h>
#include <stdlib.h>
//Define the size
#define SIZE 12000
//Time
time_t start, stop;
//Array
int arr[SIZE];
void bubble_sort(int a[]) {
for(int i=0;i<SIZE;i++) {
for(int j=0;j<SIZE-i;j++) {
if(a[j]>a[j+1]) {
int tmp = a[j];
arr[j] = arr[j+1];
arr[j+1] = tmp;
}
}
}
}
int main(int argc, char* argv[]) {
//Random filling
srand(time(NULL));
//Array initialization
for(int i=0;i<SIZE;i++) {
arr[i] = rand() % 100;
}
//Bubble sort
start = time(NULL);
bubble_sort(arr);
stop = time(NULL);
//Print the time difference between stop and start.
printf("Time difference is: %.2f s.\\",difftime(stop,start));
return 0;
}