Building a Balanced k-d Tree in O(kn log n) Time
نویسنده
چکیده
The original description of the k -d tree recognized that rebalancing techniques, such as are used to build an AVL tree or a red-black tree, are not applicable to a k -d tree. Hence, in order to build a balanced k -d tree, it is necessary to find the median of the data for each recursive subdivision of those data. The sort or selection that is used to find the median for each subdivision strongly influences the computational complexity of building a k -d tree. This paper discusses an alternative algorithm that builds a balanced k -d tree by presorting the data in each of k dimensions prior to building the tree. It then preserves the order of these k sorts during tree construction and thereby avoids the requirement for any further sorting. Moreover, this algorithm is amenable to parallel execution via multiple threads. Compared to an algorithm that finds the median for each recursive subdivision, this presorting algorithm has equivalent performance for four dimensions and better performance for three or fewer dimensions.
منابع مشابه
An algorithm for finding a k-median in a directed tree
We consider the problem of finding a k-median in a directed tree. We present an algorithm that computes a k-median in O(Pk) time where k is the number of resources to be placed and P is the path length of the tree. In the case of a balanced tree, this implies O(kn log n) time, in a random tree O(k2n3/2), while in the worst case O(kn). Our method employs dynamic programming and uses O(nk) space,...
متن کاملEdge Finding Filtering Algorithm for Discrete Cumulative Resources in O(kn log n){\mathcal O}(kn {\rm log} n)
This paper presents new Edge Finding algorithm for discrete cumulative resources, i.e. resources which can process several activities simultaneously up to some maximal capacity C. The algorithm has better time complexity than the current version of this algorithm: O(kn log n) versusO(kn2) where n is number of activities on the resource and k is number of distinct capacity demands. Moreover the ...
متن کاملFaster Geometric K-point MST Approximation
We give fast new approximation algorithms for the problem of choosing k planar points out of n to minimize the length of their minimum spanning tree (equivalently, of their traveling salesman tour or Steiner tree). For any x ≤ k, we can find an approximation achieving approximation ratio O(log k/ log x) in time O(n log n+ 2kn log k). In particular, we get an approximation with ratio O(log k/ lo...
متن کاملTree-weighted neighbors and geometric k smallest spanning trees
We compute the k smallest spanning trees of a point set in the planar Euclidean metric in time O(n log n log k+kmin(k, n) log(k/n)), and in the rectilinear metrics in time O(n log n + n log logn log k + kmin(k, n) log(k/n)). In three or four dimensions our time bound is O(n + kmin(k, n) log(k/n)), and in higher dimensions the bound is O(n2−2/(dd/2e+1)+2 + kn log n).
متن کاملar X iv : 1 00 6 . 37 15 v 1 [ cs . D S ] 1 8 Ju n 20 10 Should Static Search Trees Ever Be Unbalanced ?
In this paper we study the question of whether or not a static search tree should ever be unbalanced. We present several methods to restructure an unbalanced k-ary search tree T into a new tree R that preserves many of the properties of T while having a height of log k n+1 which is one unit off of the optimal height. More specifically, we show that it is possible to ensure that the depth of the...
متن کاملذخیره در منابع من
با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید
عنوان ژورنال:
- CoRR
دوره abs/1410.5420 شماره
صفحات -
تاریخ انتشار 2014