Complexity
- Building a static k-d tree from n points takes:
- O(n log2 n) time if an O(n log n) sort such as Heapsort is used to compute the median at each level;
- O(n log n) time if a complex linear-time median-finding algorithm such as the one described in Cormen et al. is used;
- O(kn log n) plus O(n log n) time if n points are sorted in each of k dimensions using an O(n log n) sort prior to building the k-d tree.
- Inserting a new point into a balanced k-d tree takes O(log n) time.
- Removing a point from a balanced k-d tree takes O(log n) time.
- Querying an axis-parallel range in a balanced k-d tree takes O(n1-1/k +m) time, where m is the number of the reported points, and k the dimension of the k-d tree.
Read more about this topic: K-d Tree
Famous quotes containing the word complexity:
“It is not only their own need to mother that takes some women by surprise; there is also the shock of discovering the complexity of alternative child-care arrangements that have been made to sound so simple. Those for whom the intended solution is equal parenting have found that some parents are more equal than others.”
—Elaine Heffner (20th century)
“The price we pay for the complexity of life is too high. When you think of all the effort you have to put intelephonic, technological and relationalto alter even the slightest bit of behaviour in this strange world we call social life, you are left pining for the straightforwardness of primitive peoples and their physical work.”
—Jean Baudrillard (b. 1929)
“In times like ours, where the growing complexity of life leaves us barely the time to read the newspapers, where the map of Europe has endured profound rearrangements and is perhaps on the brink of enduring yet others, where so many threatening and new problems appear everywhere, you will admit it may be demanded of a writer that he be more than a fine wit who makes us forget in idle and byzantine discussions on the merits of pure form ...”
—Marcel Proust (18711922)