Author: Stan Eisenstat
Subject: Re: [Cs223] remD() with empty head
Date: Wednesday, 18 Mar 2020, 06:41:54
> Message Posted By: Unknown
>
> If the head stack of a deque is empty and remD() is called on that deque,
> do we move all elements from the tail to the head and then perform remD()
> using the new head?
Yes. As stated in the specification:
To remove an item from the head of the Deque, pop it off the top of the
H stack (but if the H stack is empty, first move items one at a time
from the top of the T stack to the top of the H stack until the T stack
is empty).
--Stan-
PREV
INDEX
NEXT