Deleting a Node in Linked List


	public Node deleteNode(Node head,int position){
		int size=length(head);
		if(position>size||position<1){
			System.out.println("Position invalid. Valid inputs are from 1 to "+size);
			return head;
		}
		if(position==1){
			Node currentNode=head.getNext();
			head=null;
			return currentNode;
		}else{
			Node previousNode=head;
			int count=1;
			while(count
	

Leave a Reply

Your email address will not be published. Required fields are marked *