珍珠湾ART

标题: Write a function to find the middle of a single. [打印本页]

作者: hellome    时间: 2006-4-1 14:48
标题: Write a function to find the middle of a single.

Write a function to find the middle of a single linked list. Please try to find the best solution.

www.ddhw.com

 

作者: 有空想想    时间: 2006-4-1 17:40
标题: 回复:Write a function to find the middle of a single

traversing a single linked list needs O(n) time.
so finding the middle point also needs O(n) time.
so it seems no benefit we can get from the best algorithm.  
www.ddhw.com

 





欢迎光临 珍珠湾ART (http://zzwav.com/) Powered by Discuz! X3