@@ -0,0 +1,1492 @@
+package data_structures.linked_lists;%0D%0A%0D%0A/*%0D%0A * Problem Statement:%0D%0A * Youre given the pointer to the head node of a linked list and the position%0D%0A * of a node to delete. Delete the node at the given position and return the%0D%0A * head node. A position of 0 indicates head, a position of 1 indicates one node%0D%0A * away from the head and so on. The list may become empty after you delete the%0D%0A * node.%0D%0A * %0D%0A * Input Format:%0D%0A * You have to complete the Node* Delete(Node* head, int position) method which%0D%0A * takes two arguments - the head of the linked list and the position of the%0D%0A * node to delete. You should NOT read any input from stdin/console. position%0D%0A * will always be at least 0 and less than the number of the elements in the%0D%0A * list.%0D%0A * %0D%0A * Output Format:%0D%0A * Delete the node at the given position and return the head of the updated%0D%0A * linked list. Do NOT print anything to stdout/console.%0D%0A * %0D%0A * Sample Input: %0D%0A * 1 --%3E 2 --%3E 3 --%3E NULL, position = 0%0D%0A * 1 --%3E NULL , position = 0%0D%0A * %0D%0A * Sample Output: %0D%0A * 2 --%3E 3 --%3E NULL%0D%0A * NULL%0D%0A */%0D%0Apublic class DeleteANode %7B%0D%0A%0D%0A%09Node Delete(Node head, int position) %7B%0D%0A%0D%0A%09%09if (head == null) %7B%0D%0A%09%09%09return head;%0D%0A%09%09%7D else if (position == 0) %7B%0D%0A%09%09%09head = head.next;%0D%0A%09%09%09return head;%0D%0A%09%09%7D else %7B%0D%0A%09%09%09Node pointer = head;%0D%0A%09%09%09int currentPos = 0;%0D%0A%0D%0A%09%09%09while (currentPos %3C (position - 1) && pointer.next != null) %7B%0D%0A%09%09%09%09pointer = pointer.next;%0D%0A%09%09%09%09currentPos++;%0D%0A%09%09%09%7D%0D%0A%09%09%09pointer.next = pointer.next.next;%0D%0A%09%09%09return head;%0D%0A%09%09%7D%0D%0A%09%7D%0D%0A%7D

Add DeleteANode