PREV INDEX NEXT

Author: Unknown
Subject: Keeping track of 2 stacks
Date: Monday, 16 Mar 2020, 14:07:30

Dear Professor Eisenstat,

I'm having trouble understanding how to implement the deque data structure. Since it should consist of 2 stacks, I'm assuming we should be creating two stacks in the function createD in Deque.c. However, how do we keep track of the tail stack if we may not use global variables, and our linked lists must be headless so we can't return both pointers to both stacks in a single head element? 

In addition, i'm confused as to where the code for the case when the H stack is empty but the T stack is nonempty belongs in our code. Should that also be in isEmptyD (in Deque.c), or is isEmptyD reserved for checking whether both H and T are empty?
PREV INDEX NEXT