You are viewing a single comment's thread. Return to all comments →
c++ soln
SinglyLinkedListNode* deleteNode(SinglyLinkedListNode* llist, int position) { SinglyLinkedListNode* temp=llist;
if(position==0){ temp=llist->next; return temp; } else{ while(position>1){ position--; temp=temp->next; } SinglyLinkedListNode* to_remove=temp->next; temp->next=temp->next->next; delete to_remove; } 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++ soln
SinglyLinkedListNode* deleteNode(SinglyLinkedListNode* llist, int position) { SinglyLinkedListNode* temp=llist;
}