找不到符号
public class BBShortest{
static class HeapNode implements Comparable
{
int i;
int length;
HeapNode(int ii,int ll)
{
i=ii;
length=ll;
}
public int compareTo(Object x)
{
int xl=((HeapNode)x).length;
if(length<xl) return -1;
if(length==xl) return 0;
return 1;
}
}
static int [][]a=new int[][]{
{0,1000,1000,1000,1000,1000},
{1000,0,10,1000,30,100},
{1000,1000,0,50,1000,1000},
{1000,1000,1000,0,1000,10},
{1000,1000,1000,20,0,60},
{1000,1000,1000,1000,1000,0}
};
static int []dist=new int[6];
static int []p=new int[6];
public static void shortest(int v,int []dist,int []p){
int n=p.length-1;
//问题行MinHeap heap=new MinHeap();
HeapNode encode=new HeapNode(v,0);
for(int j=1;j<=n;j++)
dist[j]=1000;
dist[v]=0;
while(true){
for(int j=1;j<=n;j++)
if(a[encode.i][j]<1000&&encode.length+a[encode.i][j]<dist[j])
{
dist[j]=encode.length+a[encode.i][j];
p[j]=encode.i;
HeapNode node=new HeapNode(j,dist[j]);
heap.put(node);
}
if(heap.isEmpty()) break;
else encode=(HeapNode)heap.removeMin();
}
}
public static void main(String args[]){
BBShortest hello;
hello.shortest(1,dist,p);
//for(int i=2;i<6;i++)
//System.out.Println
}
}
编译说MinHeap heap=new MinHeap();找不到符号,为什么