配列を取り、それを最小値から最大値にソートするコードを書きましたが、エラーが発生します。これがコードです
public class minHeapify{
public static void exchange(int a[],int i,int j) {
int temp = a[i];
a[i] = a[j];
a[j] = temp;
}
public static int parent(int i) {
return (int) Math.floor((i - 1)/2);
}
public static int left(int i) {
return 2*i + 1;
}
public static int right(int i) {
return 2*(i+1);
}
public minHeapify(int a[], int start,int end) {
int l = left(start); int r = right(start);
int smallest;
if(l >= end){
smallest = (a[l] < a[start])? l: start;
}
if(r >= end){
smallest = (a[r] < a[smallest])? r: smallest;
}
if(smallest != start) {
exchange(a,start,smallest);
minHeapify(a,smallest,end);
}
}
}
私が得るエラーは「メソッドminHeapify(int []、int、int)はminHeapify型に対して未定義です」であり、それが何を意味するのかわかりません。