I am interested in having a B+ tree data structure implemented in JavaScript. The code will be released as open-source under the MIT, LGPL or similar permissive license, the coder's work can be attributed within the copyright notice should they want that.
See <[login to view URL]~kamil/teaching/su02/[login to view URL]> for information about the B+ tree system that I wish to have made, as it shows the leaf nodes all joined together. I would also want 'Rotation' as defined in <http://baze.fri.uni-lj.si/dokumenti/B+%[login to view URL]>.
I wish for DRY (Don't Repeat Yourself) principles to be used across the small data structure library that this is used in, and want it to follow the coding pattern I am already using. I think an elegant solution could be made by using, or extending my existing Doubly_Linked_List class:
var Doubly_Linked_List = [login to view URL]({
'init': function(spec) {
// spec could be the initial items for the list.
[login to view URL] = null;
[login to view URL] = null;
[login to view URL] = 0;
},
'insert_beginning': function(node) {
if ([login to view URL] == null) {
[login to view URL] = node;
[login to view URL] = node;
[login to view URL] = [];
}
},
'insert_before': function(new_node, node) {
[login to view URL] = [[login to view URL][0], node];
if ([login to view URL][0] == null) {
[login to view URL] = new_node;
} else {
[login to view URL][0].neighbours[1] = new_node;
}
},
'insert_after': function(new_node, node) {
[login to view URL] = [node, [login to view URL][1]];
if ([login to view URL][1] == null) {
[login to view URL] = new_node;
} else {
[login to view URL][1].neighbours[0] = new_node;
}
},
// not wrapping the item in a node?
'push': function(node) {
// the item gets wrapped in a node.?
if ([login to view URL] == null) {
this.insert_beginning(node);
}
}
});
Other useful classes could be made to facilitate the B+ tree such as Sorted_Doubly_Linked_List. I want to do this to reduce code repetition and increase clarity.
Simple unit testing should be done with jasmine.