COMP 2012H
Honors Object-Oriented Programming and Data Structures
Lab 4
Linked List
Common Errors
Forgetting to handle the special cases of node insertion/removal when there are only 0, 1, or 2 nodes in the linked list.
Removing the wrong node, especially when the target is the the 2nd node (
front->next
) or the 2nd-last node (
back->prev
).
Inserting the node in the incorrect position, shifted by +-1 than the expectation.
Incorrectly updating the neighboring nodes'
prev
and
next
pointers during node insertion/removal.
destroy_deque()
forgetting to also call
destroy_node
to actually deallocate heap memory.