找回密码
 立即注册
搜索
总共850条微博

动态微博

查看: 853|回复: 1
打印 上一主题 下一主题
收起左侧

Write a function to find the middle of a single.

[复制链接]

1

主题

1

帖子

43

积分

跳转到指定楼层
楼主
发表于 2006-4-1 14:48:02 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

www.ddhw.com

 
回复

使用道具 举报

56

主题

412

帖子

4544

积分

沙发
发表于 2006-4-1 17:40:04 | 只看该作者

回复: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

 
回复 支持 反对

使用道具 举报

24小时热帖
    一周热门
      原创摄影
        美食美文
          您需要登录后才可以回帖 登录 | 立即注册

          本版积分规则

          Archiver|手机版|珍珠湾ART

          Powered by Discuz! X3 © 2001-2013 All Rights Reserved