PREV INDEX NEXT

Author: Stan Eisenstat
Subject: Re: [Cs223] Aspnes' notes
Date: Friday, 17 Apr 2020, 08:11:05


    > Message Posted By: Unknown
    >
    > On Aspnes' implementation of a hash table ADT, the code defines a struct
    > hash to be:
    >
    > struct elt {
    >     struct elt *next;
    >     char *key;
    >     char *value;
    > };
    >
    > struct dict {
    >     int size;           /* size of the pointer table */
    >     int n;              /* number of elements stored */
    >     struct elt **table;
    > };
    >
    > ---
    > Since in our implementation of the hash table ADT we are required to use
    > dynamic sorted arrays for each entry of the hash table (instead of linked
    > lists), if we were to use his code, then would that mean that we have to
    > have another struct that acts as an intermediary between struct elt and
    > struct dict that allows us to have an array of elts for every entry
    > corresponding to the hash function?

That is one possibility.  Another is a separate field in
the struct dict that points to an array of bucket sizes.

--Stan-
PREV INDEX NEXT