Skip to content
StackDecode
Advanced data structuresExplained

K-D Tree

A binary tree that splits space along alternating axes.

Time

O(log n) avg search

Extra space

O(n)

Use it for

Nearest-neighbour search.

An animated walkthrough for this algorithm isn’t built yet. The summary above explains the idea; see the related animated algorithms below to practise the same technique.