K-d tree: Difference between revisions

326 bytes added ,  10 years ago
m
Line 920:
└─────────┴──┴──────────────────────────┘</lang>
 
So, why are trees "generally a bad idea in J"?
So, what's the problem here?
 
First off, that's a lot of code, it took time to write. Let's assume that that time was free. Let's also assume that the time taken to build the tree structure was free. We're going to use this tree billions of times. Now what?
Line 969:
 
On the bigger dataset, the kdtree implementation is almost ten times slower than the brute force implementation.
 
Exercise for the student: work out the cost of cpu time and decide how big of a dataset you need for the time it takes to implement the kdtree to pay back the investment of time needed to implement it. Also work out how many times the tree has to be accessed to more than cover the time needed to build it.
 
See also: [[wp:KISS_principle]]
6,962

edits