link find_reverse(int k)
{
int i = 0;
link p = NULL;
link q= NULL;
p = head;
q = head;
for(i = 0; i < k &&p; i++,p = p->next);
if(p == NULL)
return NULL;
for(;p;p = p->next,q = q->next);
return q;
}
打印单链表的倒数第k个结点
最新推荐文章于 2021-05-24 11:07:48 发布