Skip to content

Instantly share code, notes, and snippets.

@mogutou1214
Created September 2, 2013 17:25
Show Gist options
  • Save mogutou1214/6415251 to your computer and use it in GitHub Desktop.
Save mogutou1214/6415251 to your computer and use it in GitHub Desktop.
Careercup 2.3 - Implement an algorithm to delete a node in the middle of a single linked list, given only access to that node EXAMPLE Input: the node ‘c’ from the linked list a->b->c->d->e Result: nothing is returned, but the new linked list looks like a->b->d->e
void delGivenNode(node *entry){
entry->data = (entry->next)->data;
entry->next = (entry->next)->next;
delete entry->next;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment