jiaguofang / b-plus-tree Goto Github PK
View Code? Open in Web Editor NEWA Java implementation of B+ tree for key-value store
License: MIT License
A Java implementation of B+ tree for key-value store
License: MIT License
这个代码,删除中间值没问题,如果删除的是节点的边界值,会有问题,
插入 [0 ,30]
{[16]}
{[4, 8, 12], [20, 24, 28]}
{[0, 1, 2, 3], [4, 5, 6, 7], [8, 9, 10, 11], [12, 13, 14, 15]}, {[16, 17, 18, 19], [20, 21, 22, 23], [24, 25, 26, 27], [28, 29, 30]}
删除24
{[16]}
{[4, 8, 12], [20, 24, 28]}
{[0, 1, 2, 3], [4, 5, 6, 7], [8, 9, 10, 11], [12, 13, 14, 15]}, {[16, 17, 18, 19], [20, 21, 22, 23], [25, 26, 27], [28, 29, 30]}
删除25
{[16]}
{[4, 8, 12], [20, 24, 28]}
{[0, 1, 2, 3], [4, 5, 6, 7], [8, 9, 10, 11], [12, 13, 14, 15]}, {[16, 17, 18, 19], [20, 21, 22, 23, 26, 27], [26, 27], [28, 29, 30]}
删除26
{[16]}
{[4, 8, 12], [20, 24, 26, 28]}
{[0, 1, 2, 3], [4, 5, 6, 7], [8, 9, 10, 11], [12, 13, 14, 15]}, {[16, 17, 18, 19], [20, 21, 22, 23], [27], [26, 27, 27], [28, 29, 30]}
实际26还在,还能查出来,主要是因为删除叶子节点最左边(分界点),没有更新父节点对应的数据
I think the delete() implementation might need to be improved. Please see the following failed test:
@Test
public void testDelete() throws Exception
{
BPlusTree<String,String> t = new BPlusTree<String,String>(4);
t.insert("1", "1");
t.insert("2", "2");
t.insert("3", "3");
t.insert("4", "4");
t.delete("3"); // FIX breaks the tree invariants
t.delete("4"); // throws an exception
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.