You are on page 1of 2

CS 32 TA section: Memory Allocation and Linked List

http://cs.ucla.edu/~yliu/cs32/

code for step one of delete:
while(cur != NULL && cur ->next->value != val)
cur = cur -> next;
if (cur->next)
return;

DOUBLY-LINKED LIST
has a pointer to the node before it and the node after it
head pointer points to start (address of first node)
tail pointer points to end (address of last node)
EDGE CASES
1. number of nodes is 0, 1, 2+
2. position of the nodes: beginning, middle, end

for inserting in middle:
head, (insert p), q
p->next = q;
p->prev = q->next;
q->prev = p;
p->prev->next = p;

STACK:
void push(int val): inserts something in
pop()

class LLStack
{
public:
LLStack()
{
}
int puch
}

You might also like