node *search(node *head)
{
int i = 0;
int j = 0;
node *current = NULL;
node *middle = NULL;
current = middle = head->next;
while(current!=NULL)
{
if(i/2>j)
{
j++;
middle = middle->next;
]
i++;
current=current->next;
}
return middle;
}
单链表的中间元素
最新推荐文章于 2021-09-28 19:00:02 发布