My first question on this board and I really need some help in order to figure out what could be wrong with my code. I decided to go with a a selection sort but as soon as I run ./generate 2 2 in order to check if it works i get this unsorted list.
38906
31103
I implemented the code as follows:
for (int i = 0; i < n; i++)
{
int min = i;
for (int j = i+1; j < n; j++)
{
if (values[min]>values[j])
{
min = j;
int temp = values[min];
values [min] = values [i];
values [i] = temp;
}
}
}
return ;
It would be great if somebody could point me in the right direction. Am I actually checking my code in the right way. I couldn't figure out how to use gdb for debugging since there is no ruining file just the helpers.c.
Thank you in advance!