mortonnex
V2EX  ›  问与答

平衡树还是跳表?

  •  
  •   mortonnex · Feb 18, 2019 · 1311 views
    This topic created in 2652 days ago, the information mentioned may be changed or developed.
    从插入性能和查找性能来讲,跳表都更出色

    所以怎么取舍?
    1 replies    2019-02-18 19:56:10 +08:00
    rayingecho
        1
    rayingecho  
       Feb 18, 2019   ❤️ 2
    平衡树的最差查找时间是有保证的, 一定是 O(LogN)
    跳表每层的的链表是随机生成的, 最差查找时间不稳定, 只能说平均是 O(LogN), 但最差是可以 O(N) 的
    但跳表插入更快且对并发更友好, 平衡树需要旋转, overhead 比较大
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   861 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 39ms · UTC 21:43 · PVG 05:43 · LAX 14:43 · JFK 17:43
    ♥ Do have faith in what you're doing.