//寻找单链表的中间结点
//思路:定义快指针fast,慢指针slow
public Node searchMediumNode(Node head){
Node fast=head;
Node slow=head;
while(fast!=null&&fast.next!=null&&fast.next.next!=null){
fast=fast.next.next;
slow=slow.next;
}
return slow;
}
链表-寻找单链表的中间结点
猜你喜欢
转载自blog.csdn.net/weixin_42146769/article/details/88375525
今日推荐
周排行