Compiler error

Joined
May 8, 2009
Messages
1
Reaction score
0
Hello all,

I get the folloing error:

quicksort(int[],int,int)cannot be applied to(int[])

When I compile this:

Code:
import java.util.*;

public class Sort {

public static void main(String[] args){
	
Random rand = new Random();
int[] tab = new int[10];

for(int i = 0; i < tab.length; i++) {
tab[i] = rand.nextInt(100);

System.out.println("Before: ");
show(tab);

quicksort (tab);
System.out.println("After: ");
show(tab);
  }
}
static void quicksort(int tab[], int x, int y) {
		
		int i,j,v,temp;
		
		i=x;
		j=y;
		v=tab[(x+y) / 2];
		do {
			while (tab[i]<v) 
				i++;
			while (v<tab[j]) 
				j--;
			if (i<=j) {
				temp=tab[i];
				tab[i]=tab[j];
				tab[j]=temp;
				i++;
				j--;
			}
		}
		while (i<=j);
		if (x<j) 
			quicksort(tab,x,j);
		if (i<y) 
			quicksort(tab,i,y);
	}


static void show (int tab[]) {
for (int i = 0; i <tab.length; i++) {
System.out.println(tab[i]);

  }
 }
}
What am I doing wrong?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,151
Latest member
JaclynMarl
Top