You are viewing a single comment's thread. Return to all comments →
c# solution :
public static SinglyLinkedListNode deleteNode(SinglyLinkedListNode llist, int position) { int i = 0; var temp = llist; while (temp != null) { if (i == position) { return null; } if (i == position -1 ) { if (temp.next.next != null) { temp.next.data = temp.next.next.data; temp.next.next = temp.next.next.next; } else { temp.next = null; } return llist; } temp = temp.next; i++; } return llist; }
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 →
c# solution :