Introduction
This is a B+Tree implementation.
Background
Fundamentals of Database System. 5th Edition. Korean Translation.
Using the code
Include BPNode.h and BPTree.h.
You can use CBPTree<Key, Value, Degree> as follows.
Degree has 2 as default.
#include "BPNode.h"
#include "BPTree.h"
CBPTree<int, std::string> bpTree;
bpTree.Insert(10, "This is a test");
std::string s;
if(bpTree.Search(10, s))
{
cout << s;
}
else
{
cerr << "Key not found" << endl;
}
CBPTree<int, std::string>::iterator i;
for(i = bpTree.begin(); i != bpTree.end(); i++)
{
cout << *i << " ";
}
Please refer to Source code how to use it.
I developed it with Visual Studio 2008. But, I tried to write it would work with any C++ compiler. I wanted to compile it on Linux. But I have no linux machine. If someone try, please let me know the result.
When you open the project with VS2008, You can see how Index(Intermediate) Nodes and Leaf Nodes splits. Please do not scold me for the crude painting. ;)
I shall improve it to support the [] operator. Like std::map.
And further improvement would support disk-based B+Tree, more generalized Node Class, etc.
Please let me know your comments, advices, test results or bugs..
It will be a greatly pleasure for me to receive any feedback.
Points of Interest
Making a cool-looking UI is always hard. ;)
History
2008. 9. 16. First upload.