0
void insert_node(Node *p){
    Node *tmp;
    tmp = new Node;
    tmp = p;
    if(first == NULL){
        status ++;
        tmp->next = NULL;
        first = tmp;
    }
    else{
        status ++;
        tmp->next = first;
        first = tmp;
    }
}


void Resize_content(){

    if( status2 >= 7*space/10){
        Entry *tmp;
        tmp = new Entry[2*space];
        for(int i=0;i<space;i++){
            Node *paux;
            paux = content[i].first;
            while(paux){
                //Node &caux = *paux;
                tmp[paux->hash_index%(2*space)].insert_node(paux);
                paux = paux ->next;
            }
        }
        delete[] content;
        content = new Entry[2*space];
        content = tmp;
        space = 2*space;
    }

}

contentサイズ空間のベクトル リスト エントリです。要素の数がスペースの 70% を超えると、要素を別の位置に移動する必要があります。問題は、insert_node の後に paux->next が NULL になり、移動されないため、要素が同じリストから形成されることです。

4

1 に答える 1