You are viewing a single comment's thread. Return to all comments →
public static SinglyLinkedListNode deleteNode(SinglyLinkedListNode head, int position) { SinglyLinkedListNode temp=head; if (head==null||head.next==null) { return head; } else if(position==0){ head=head.next; return head; } for (int i = 0; i < position-1; i++) { temp=temp.next; } temp.next=(temp.next).next; return head; }
Seems like cookies are disabled on this browser, please enable them to open this website
Delete a Node
You are viewing a single comment's thread. Return to all comments →