1.反转链表
倒指针的导向
2.链表的中间结点
3.移除链表元素
struct ListNode* removeElements(struct ListNode* head, int val)
{
struct ListNode*prev=NULL;
struct ListNode*cur=head;
while(cur)
{
if(cur->val==val) //头删的处理
{
if(cur==head)
{
head=cur->next;
free(cur);
cur=head;
}
else
{
prev->next=cur->next;//删除的处理
free(cur);
cur=prev->next;
}
}
else
{
prev=cur; //迭代的走
cur=cur->next;
}
}
return head;
}