这篇讲关于链表的故事,先来一个经典的题目吧:链表反转:
LinkedListNode * revertLinkedlist(LinkedListNode *list) { if(list == NULL || list->next == NULL) return list; LinkedListNode *prev,*cur, *t; prev = NULL; cur = list; while(cur!=NULL) { t = cur->next; cur->next = prev; prev = cur; cur = t; } return prev; }