5.找单链表倒数第k个结点
Node* Get_Kth_Node(Node* plist, int k)
{
Node* p = plist;
Node* q = plist;for (int i = 0; i < k; i++)q = q->next;while (q != NULL)
{p = p->next;q = q->next;
}return p;
}
深耕网站建设、视觉设计与SEO优化的一线实战洞察。
5.找单链表倒数第k个结点
Node* Get_Kth_Node(Node* plist, int k)
{
Node* p = plist;
Node* q = plist;for (int i = 0; i < k; i++)q = q->next;while (q != NULL)
{p = p->next;q = q->next;
}return p;
}