/* Pseudo-code to do recursive ops on singly linked list shaynes 10/9/2017 */ // head is a reference to a Node // Node contains int data // Node next Node insert (head, x) { if (head == null) return new Node (x, null); head.next = insert(head.next, x); return head; } Node delete (head, x) { if (head == null) return head; if (head.data == x) return head.next; head.next = delete(head.next, x); return head; Node find (head, x) { if (head == null) return null; if (head.data == x) return head; return find(head.next, x); } /* example usage: head = null; head = insert (head, 1); head = insert (head, 2); head = insert (head, 3); // list is currently (1, 2, 3) p = find (head, 2); head = delete (head, 3); head = delete (head, 1); */