public static Node2 insert(Node2 head, int data) { Node2 p = new Node2(data); if (head == null) { head = p; } else if (head.next == null) { head.next = p; } else { Node2 start = head; while (start.next != null) { start = start.next; } start.next = p; } return(head); }
public static Node2 removeDuplicates(Node2 head) { //Write your code here }
public Node2(int d) { data = d; next = null; }