Created
February 8, 2012 14:50
-
-
Save PhDP/1770203 to your computer and use it in GitHub Desktop.
int isll_rm_tail(isll *l)
This file contains hidden or 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
// Slow -> O(n). Return 1 if a node was removed, 0 otherwise. Untested :P | |
int isll_rm_tail(isll *l) | |
{ | |
if (l->head == NULL) | |
{ | |
return 0; | |
} | |
if (l->head == l->tail) | |
{ | |
return isll_rm_next(l, NULL); | |
} | |
isllnode *node = l->head; | |
while (node->next != l->tail) | |
{ | |
node = node->next; | |
} | |
return isll_rm_next(l, node); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment