Dear all, I use quick sort to do pre-process, however, it meets error as "runtime error". I use sort method in <algorithm>, then it is accepted.

I have two question:

- Does it a linear method? I don't think so.
- what's wrong in my quick sort?

code is below:

```
#include <algorithm>
// my quick sort
int Compare(const void *elem1, const void *elem2)
{
return *((int *)(elem1)) - *((int *)(elem2)) > 0 ? 1 : -1;
}
class Solution {
public:
int singleNumber(int A[], int n)
{
if (n == 1 || n&0x01 == 0)
{
return A[0];
}
//qsort(A, n, sizeof(int), Compare); // my qsort
sort(A, A+n); // accept method
for (int i=1; i<n; i+=2)
{
if (A[i]^A[i-1])
return A[i-1];
}
return A[n-1];
}
};
```