Created
September 2, 2013 17:25
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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