• 请不要在回答技术问题时复制粘贴 AI 生成的内容
tzheng
V2EX  ›  程序员

Twitter 排序法

  •  
  •   tzheng · Jan 20, 2015 · 4172 views
    This topic created in 4212 days ago, the information mentioned may be changed or developed.

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

    NOT

    5 replies    2015-01-20 11:44:42 +08:00
    KentY
        1
    KentY  
       Jan 20, 2015 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  
       Jan 20, 2015
    是挺科学的,效率比猴子🙊排序高多啦~!
    jizhouli
        3
    jizhouli  
       Jan 20, 2015
    @KentY easy...easy, just for fun!
    VYSE
        4
    VYSE  
       Jan 20, 2015
    验证正确性时候还是比较了啊。
    for i in range(len(givenNumbers)):
    if i > 0:
    if not givenNumbers[i] >= givenNumbers[i - 1]:
    areSorted = False
    break
    jizhouli
        5
    jizhouli  
       Jan 20, 2015
    这思路是个很通用的解决方案嘛,适用于各种需求,如排序、搜索、推荐、专家系统、图像声音视频等等各种识别。。。哈哈
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2896 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 13:32 · PVG 21:32 · LAX 06:32 · JFK 09:32
    ♥ Do have faith in what you're doing.