Sunday, January 22nd, 2006

kd-tree applet

Filed under: — Daniel Lemire @ 1:04

k-dimensional trees are a clever way to select all points in a rectangle using O(sqrt(n)+k) time where n is the total number of points and k is the number of points in the range. I usually don’t care for applets as a way to illustrate results (though I have two on my own web site doing just that!), but this kd-tree applet is a great trick. I post this here because I want to use it in a course if I ever have to teach this concept. The applet is in the public domain, but was written by Jacob Marner.

I resisted posting the applet here, because I know Java can crash some browsers or create other trouble. Sad. Java is an ok language and I really wish it would work in the browser.

3 Comments »

  1. Actually, kd-trees require O(n^{1-1/d} + k) time to report the k points in a d-dimensional box. For rectangles in the plane, that’s O(sqrt{n} + k).

    Comment by JeffE — 25/1/2006 @ 18:53

  2. Thanks. I meant to type O(sqrt{n} + k) but wrote O(log{n} + k) instead, thanks for pointing out the typo. Thanks also for giving out the general result.

    Aren’t you busy attending SODA or something like it? I guess it must be over.

    Comment by Daniel Lemire — 25/1/2006 @ 19:02

  3. Where is the KD-Tree applet?… can you send it to me please? Thanks!

    Comment by Checho — 16/3/2006 @ 15:01

RSS feed for comments on this post.

Leave a comment

Warning: When entering a long comment, please ensure that you make copy of your text prior to submitting it. If the server should fail or if you hit a bug, you might lose your work. I am not responsible for your lost effort.

To spammers: I carefully review every single post and make sure that spam gets deleted. You are wasting your time if you are manually entering spam using this form. Read my terms of use to see what I consider to be abusive.

Example: I + II + IX= XII. Yes, you have to enter a roman numeral. (Answer must be in upper case.)

« Blog's main page

26 queries. 0.327 seconds. Valid XHTML

Powered by WordPress

Subscribe to this blog in a reader or by Email.