PREV INDEX NEXT

Author: Stan Eisenstat
Subject: Re: [Cs223] remD and headD
Date: Friday, 13 Mar 2020, 12:30:01


    > Message Posted By: Unknown
    ...
    > I had a question regarding the difference between remD and headD. Based on
    > my understanding, remD completely "deletes" the node while setting a
    > pointer to that string so we have the value of it; while headD does no
    > altering to the deque, but simply pulls the value (the string) stored at
    > the first node. If this is correct, for headD how would the value of *d
    > change? (if we're not altering the deque)

If the H stack is empty and the T stack is not, then
headD() must change the internal structure of *D.  Now
imagine an implementation where *D is a pointer to a
malloc()ed block of storage and such a change induces
a change in the amount of storage required (e.g., it
reclaims unused space).

--Stan-
PREV INDEX NEXT