Code Monkey home page Code Monkey logo

bbtree's Introduction

Stand with Ukraine

Hi! I'm Volodymyr Agafonkin.

I'm a software engineer. I created Leaflet, the number one library for interactive web maps, and maintain 40+ other open source projects with a focus on algorithms, computational geometry and data visualization. I'm building the future of maps at Mapbox. Here are a few of my best tech articles: https://agafonkin.com

I'm a musician. I write songs, play guitar and sing in Obiymy Doschu. If you like beautiful, evocative rock music with lush string arrangements, check out our last album.

I'm a father to beautiful 9-year-old twin girls, I'm happily married and live in Kyiv, Ukraine. I love baking, photography, strength training, martial arts, reading sci-fi and fantasy, and exploring quiet parks. You can find tidbits of my life on X (Twitter), Instagram and Facebook.

bbtree's People

Contributors

mourner avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

bbtree's Issues

Which one was the fastest?

So, which one was the fastest algorithm? This is nowhere mentioned and the test script doesn't indicate one.

llrb.js – Remove Gets Values Mixed Up

Thanks for this project. Good stuff. I noticed one small defect, which has a quick fix:

There is a minor typo in llrb.js, in the remove(h, key, compare) method, line 111 currently, where it uses “val”, instead of “value”. This results in the value of the removed node being retained, and the value of another node being lost. Easy fix: just change the two instances of “val” on that line to “value”. Seems to work great after that.

new BBTree().find(x) causes exception (cannot search on empty tree)

Hi, this is a neat implementation.

But your find() function does not consider empty trees, so searching in an empty tree causes an exception to be thrown (which is usually no expected behavior on collections).

Adding an if-null-return test fixes this issue:

find : function (key) {
	    if( !this.root ) 
		return null;
            var node = this.root,
		compare = this._compare;

            while (node !== bottom) {
		var c = compare(key, node.key);
		if (c === 0) return node;
		node = c < 0 ? node.left : node.right;
            }
            return null;
    };

Greetings!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.