COSC 311 HOMEWORK #3 Distributed 1/29/2013, Due 2/5/2013 1. Give Java code fragment to insert a node, referenced by n, after the node p in a singly linked list. Include all 'special cases': - insert to empty list - insert after tail - insert to middle of list Recap: n references the new node. the linked list uses head to point to the first element in the list p is a reference to the node which will precede the newly inserted n. 2. Give Java code fragment to delete a node referenced by p from a linked list. Include all 'special cases': - p is in the middle - p is the last element - p is the first element