COMP 2012H
Honors Object-Oriented Programming and Data Structures
Lab 3
Pointers and Linked List
Common Errors
- Forgetting to delete the 3D Array at the end of the function.
- Typical Linked List related errors when insert/delete/swap.
- nullptr exception when dealing with head/tail nodes, especially for swap.
- Forget to also update prev node pointers.
- Forget to update head/tail pointer when insert/delete/swap at start/end of linked list.
Special Cases
- The swap algorithm can actually be very compact, with only checking for head/tail, without extra checking for adjacent nodes.
However, implementing in this compact way can be quite difficult, the order of operations matters very much, and it is very easy to make mistakes.
This was the primary reason why the lab3 solution handled adjacent nodes separately.
Still, there was one student who successfully managed to implement in this compact way. So as long as the swap output is correct, I think we can accept this compact implementation.