Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

关于d3.bisector 二分查找排序数组中的值 #89

Open
ckinmind opened this issue May 30, 2018 · 0 comments
Open

关于d3.bisector 二分查找排序数组中的值 #89

ckinmind opened this issue May 30, 2018 · 0 comments

Comments

@ckinmind
Copy link
Owner

ckinmind commented May 30, 2018

参考资料:


bisector的作用通俗解释是如果你要往一个数组插入一个值,bisect的作用是帮你找到要插入的位置,如果要插入的值数组里已经有了,此时插入就有两个位置可以插入,d3.bisectRight 和 d3.bisectLeft 来决定是往左边插还是往右边插入


d3.bisect(array, x[, lo[, hi]])

array是要查找的数组
x是要查找位置的数据
lo (似乎是查找的起始点,文档这里没看懂,自己测试一下就知道逻辑)

@ckinmind ckinmind changed the title 关于d3.bisect 二分查找排序数组中的值 关于d3.bisector 二分查找排序数组中的值 May 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant