public int medium() {
Node slowPtr = head;
Node fastPtr = head;
Node preSlow = head;
if (head != null)
{
while (fastPtr != null && fastPtr.next != null)
{
fastPtr = fastPtr.next.next;
preSlow = slowPtr;
slowPtr = slowPtr.next;
}
if (fastPtr != null)
{
return slowPtr.value;
}
else
{
return (slowPtr.value + preSlow.value) / 2;
}
}
return 0;
}
1m58s / maccms10 Goto Github PK
View Code? Open in Web Editor NEWThis project forked from maccmspro/maccms10
苹果cms-v10,maccms-v10,麦克cms,开源cms,内容管理系统,视频分享程序,分集剧情程序,网址导航程序,文章程序,漫画程序,图片程序
License: Apache License 2.0