# pset3 find code works, despite 'sort' failing

I'm very confused! I have spent many (MANY) hours working through this pset. I've gotten to the point where my code passes all check50 requirements for 'find', but it's failing the 'sort' requirements. I'm not even sure how this is possible (wouldn't it have to be sorted for my 'find' algorithm to work??). Here's my sort code... any help would be GREATLY appreciated:

``````void sort(int values[], int n)
{
//implement a sorting algorithm: bubble
for (int i = 0; i < (n - 1); i ++)//iterate through first time
{
for (int j = 1; j < n - i - 1; j ++)//iterate through again without last
{
if (values[j] > values[j + 1])
{
int swap = values[i];
values[i] = values[i+1];
values[i+1] = swap;
}
}
}
return;
}
``````

Here's what I get from check50:

:( sorts {5,4,3,2,1} expected "2", not "\n"

:( sorts {5,3,1,2,4,6} expected "3", not "\n6\n"

All the rest are smiley faces (explain how 'find' could work if the 'sort' is failing??)

``````:) finds 28 in {28,29,30}
:) finds 28 in {27,28,29}
:) finds 28 in {26,27,28}
:) finds 28 in {27,28,29,30}
:) finds 28 in {26,27,28,29}
:) finds 28 in {25,26,27,28}
:) doesn't find 28 in {25,26,27}
:) doesn't find 28 in {25,26,27,29}
:) doesn't find 28 in {29,30,31,32}
:) doesn't find 28 in {29, 30, 31}
:) finds 28 in {30,27,28,26}
``````

Thanks so much!!!