PREV INDEX NEXT

Author: Stan Eisenstat
Subject: Re: [Cs223] Memory for char*s in HashTable
Date: Monday, 13 Apr 2020, 15:20:59


    > Message Posted By: Unknown
    >
    > Should our HashTable be allocating the space for the char*s that hold the
    > position and reached-from strings? ...

Your choice.  If it makes copies of the strings inserted,
any space allocated in the call program must be freed.
Otherwise that space cannot be freed.
=====

    >                               ...  I am confused how else to keep
    > allocating memory for new strings otherwise. Also does your Deque adt
    > expect that that Char*s being added are already allocated or does it
    > allocate memory for each new string added?

The Deque ADT does not make copies of the strings it stores.

--Stan-
PREV INDEX NEXT