2024年4月30日发(作者:)
#include
#include
typedef struct _DLNode
{
struct _DLNode *next;
int value;
} DLNode;
/*
* 1. 如果链有没有节点,就返回NULL
* 2. 如果链表只有一个节点,输入节点的前驱节点就是它本身,则返回输入节点
* 3. 如果链表有多于一个节点,就返回输入节点的前驱节点
*/
DLNode* getPriorNode(DLNode *node)
{
DLNode *next;
if (!node)
{
return NULL;
}
next = node->next;
while (node != next->next)
{
next = next->next;
}
return next;
}
发布者:admin,转转请注明出处:http://www.yc00.com/web/1714440374a2446920.html
评论列表(0条)