You are viewing a single comment's thread. Return to all comments →
you still need to re-link the linkedlist after deletion. like this
Node Delete(Node head, int position) { if (head == null) return null;
if (position == 0) { head = head.next; } else { Node back = head; for (int i=0;i<position-1;++i) { back = back.next; } back.next = back.next.next; } return head;
}
Delete a Node
You are viewing a single comment's thread. Return to all comments →
you still need to re-link the linkedlist after deletion. like this
Node Delete(Node head, int position) { if (head == null) return null;
}