GithubHelp home page GithubHelp logo

Comments (2)

bwangelme avatar bwangelme commented on June 8, 2024

level[0]中的span应该总是1,这样才能解释rank[0] - rank[i]。我们可以举这样一个例子,

例如有节点A和B,在他们中间插入X,(rank[0] - rank[i])计算的就是A到X-1的距离,update[i]->level[i].span就是A到B的距离。update[i]->level[i].span - (rank[0] - rank[i])计算的就是B到X的距离。

update[i]->level[i].span = (rank[0] - rank[i]) + 1计算的是A到X-1在+1,表示的是A到X的距离。

计算距离的时候是 左开右闭

刚刚才想通,语言有点混乱,感觉还是要画个图。:Laugh:

from redis-3.0-annotated.

dujuejue avatar dujuejue commented on June 8, 2024

我刚刚把span的定义理解错了,然后翻到铁子的这个issue,一下找到自己的问题,刚刚最开始也一直没理解这两行代码

from redis-3.0-annotated.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.