java - JUnit Test error -
i trying run junit test program, getting error message
*incompatible types required: int[]; found: int *
here code shows error
myqsarray = qs.quicksort(sortedarray2,0, sortedarray2.length - 1);
and here call quicksort method
public static int quicksort( int a[], int p, int r){ int q; if (p<r) { q = partition(a,p,r); quicksort(a, p, q-1); quicksort(a,q+1,r); } return qs1.quicksort(a, p, r); }
help please, in advance
i see couple of problems code:
the method declared return int
value try assign int
int[]
. causes actual compiletime error. change method signature
public static int[] quicksort( int a[], int p, int r)
for quick fix.
then, recursive function quicksort
misses exit criteria. run indefinitely (or @ least until virtual machine gives , throws stackoverflowexception
after couple of milliseconds). need add criteria check, if array sorted , return sorted array (see "new" method signature!).
Comments
Post a Comment