PREV INDEX NEXT

Author: Stan Eisenstat
Subject: Re: [Cs223] Rehashing
Date: Saturday, 11 Apr 2020, 07:15:35


    > Message Posted By: Unknown
    >
    > I have an insert function in my file that codes the hash table, which
    > inserts a triple into a hash table (from nine20.c). When we are rehashing,
    > should we move all the pointers to these triples in our current hash table
    > to another table, resize the original hash table, and then use the insert
    > function again to put these triples back into the resized hash table?

That is one approach that works.
=====

    > The reason I ask is because when I rehash, I am calling insert again on
    > each of the triples I had already inserted before into my table (so the
    > time it takes to do this is very long). Otherwise, what other way can I
    > move the triple back to the resized hash table so that it is placed in the
    > correct search table and correct index.

When the size of the table increases, triples that were
in the old table are not necessarily placed in the same
bucket in the new table.  Thus reinsertion is required.

To diagnose why your code takes a long time, I would
need to see and run it.

--Stan-
PREV INDEX NEXT