B# tree and Array intersection in javascript

I was in need for a solution to search a very large set of data in a javascript application. I thought of a b+ tree. Looking for a javascript implementation of it, google didn’t help much. So, I just gave up and decided to implement it myself. This is the result: not really a B+ tree but a variation that works better in this case. I call it a B# tree. It depends on the prototype framework but I’m planning on making some changes to it so it would work stand-alone.

It contains a very efficient intersect method. To use it just do something like this:

You can set any object as the second parameter to the BSharpTree#add method but then you might need to pass a comparator function to the BSharpTree constructor. Use it as you may see fit!

2 Responses

  1. Graham
    Graham May 3, 2013 at 7:32 pm |

    I’m not sure what the difference is between a B+Tree and your B#Tree, but if you want a pure JavaScript version with deletion, skipping etc try out my one at:


    I think you’ll find it performs much faster than a framework based one.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.