Talk:Kd-tree

From RoboWiki
(Difference between revisions)
Jump to: navigation, search
(-ary-ness)
(also ...)
Line 8: Line 8:
  
 
In a binary tree you do 1 comparison to narrow it down to 1/2 the tree (if it's well balanced).  In a 3-ary you do (on average) 1.5 comparisons to narrow it to 1/3.  4-ary 2 comparisons for 1/4 of the tree.  1*1/2 = 1.5*1/3 = 2*1/4.  They're all theoretically the same. --[[User:Simonton|Simonton]] 15:33, 15 August 2009 (UTC)
 
In a binary tree you do 1 comparison to narrow it down to 1/2 the tree (if it's well balanced).  In a 3-ary you do (on average) 1.5 comparisons to narrow it to 1/3.  4-ary 2 comparisons for 1/4 of the tree.  1*1/2 = 1.5*1/3 = 2*1/4.  They're all theoretically the same. --[[User:Simonton|Simonton]] 15:33, 15 August 2009 (UTC)
 +
 +
* Also note that with a 4-ary tree it's best to do a binary search at each node, which is pretty much the same thing as going back to a binary tree, except you'd be doing two comparisons for the same dimension instead of stepping to the next.  --[[User:Simonton|Simonton]] 15:36, 15 August 2009 (UTC)

Revision as of 15:36, 15 August 2009

Bucket PR k-d tree

I think you all know about Bucket PR k-d tree (aka Simonton's tree), right? I'll get directly to my point.

The Bucket PR k-d tree (I'll refer as just a tree from now on) is a binary tree split by the median of the bound, right? I wonder if I make it m-ary tree, let say, Ternary or Quaternary tree instead of just binary? Will it better? » Nat | Talk » 09:12, 15 August 2009 (UTC)

Note, it doesn't by definition have to be split by the median, though the median is usually considered the best place. As far as your second question... it may be better, or it may not. I'm pretty sure it will depend heavily on the implementation details and the data set in question. --Rednaxela 14:51, 15 August 2009 (UTC)

In a binary tree you do 1 comparison to narrow it down to 1/2 the tree (if it's well balanced). In a 3-ary you do (on average) 1.5 comparisons to narrow it to 1/3. 4-ary 2 comparisons for 1/4 of the tree. 1*1/2 = 1.5*1/3 = 2*1/4. They're all theoretically the same. --Simonton 15:33, 15 August 2009 (UTC)

  • Also note that with a 4-ary tree it's best to do a binary search at each node, which is pretty much the same thing as going back to a binary tree, except you'd be doing two comparisons for the same dimension instead of stepping to the next. --Simonton 15:36, 15 August 2009 (UTC)
Personal tools