public static Node returnHalfNode(Node head){
Node lastNode=head;
while(head!=null){
halfDataStack.add(head);
lastNode=lastNode.next.next;
if(lastNode==null){
return head;
}
if(lastNode.next==null){
return head.next;
}
head=head.next;
}
return head;
}
返回链表中间的node
猜你喜欢
转载自blog.csdn.net/qq_42667028/article/details/86759436
今日推荐
周排行