V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
tzheng
V2EX  ›  程序员

Twitter 排序法

  •  
  •   tzheng · 2015-01-20 02:14:26 +08:00 · 3165 次点击
    这是一个创建于 3356 天前的主题,其中的信息可能已经有所发展或是发生改变。

    https://github.com/ExPHAT/twitter-sort
    刚在网上看见的,把没排序的数发上twitter,等别人帮你排序了返回给你。目测是我今年看见的非比较排序中最科学的。。。

    NOT

    5 条回复    2015-01-20 11:44:42 +08:00
    KentY
        1
    KentY  
       2015-01-20 02:24:23 +08:00 via iPhone
    When someone replies with a sorted version of the numbers, it will print them to the console and return.

    这个应该是async吧?要么程序一直等着别人回答?
    还有怎么判断别人回复的结果正确性?自己走一趟O(n)?
    总字符不超过140?
    算个有意思的玩具吧,不理解科学在哪
    MayLava
        2
    MayLava  
       2015-01-20 02:36:37 +08:00
    是挺科学的,效率比猴子🙊排序高多啦~!
    jizhouli
        3
    jizhouli  
       2015-01-20 11:41:20 +08:00
    @KentY easy...easy, just for fun!
    VYSE
        4
    VYSE  
       2015-01-20 11:43:35 +08:00
    验证正确性时候还是比较了啊。
    for i in range(len(givenNumbers)):
    if i > 0:
    if not givenNumbers[i] >= givenNumbers[i - 1]:
    areSorted = False
    break
    jizhouli
        5
    jizhouli  
       2015-01-20 11:44:42 +08:00
    这思路是个很通用的解决方案嘛,适用于各种需求,如排序、搜索、推荐、专家系统、图像声音视频等等各种识别。。。哈哈
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1953 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 00:00 · PVG 08:00 · LAX 17:00 · JFK 20:00
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.