0
我在写一个哈希表代码。根据表大小采取模式。我想从表-1开始,并且null。我明白它是空的。 Java哈希表就绪。所以我没有找到很多例子。Java哈希表填充
我的fill_in方法未运行。
class Node{
int index;
int number;
Node next;
public Node(int index,int number,Node next){
this.index=index;
this.next=next;
this.number=number;
}
}
class Table{
int max_row;
public Table(int size){
this.max_row=size;
}
Node rows[]= new Node[max_row];
public void fill_in(){
for(int i=0; i<max_row;i++)
rows[i]=new Node(-1,-1,null);
}
“不运行”或“不编译”? –
ArrayIndexOutOfBoundsException – mrsengineer
您的尺寸是多少?你的输入示例? – Frakcool