\begin{figure}
\begin{alltt}
function KD-Tree(data, level = 0)
  if(empty(data))
    exit
  
  attr = depth % k
  
  median = Median value from attribute attr in data
  
  node.value = node
  node.attribute = attr
  node.leftChild = KD-Tree(data where attribute attr is greater than median, 
                           level + 1)
  node.rightChild = KD-Tree(data where attribute attr is less than median, level + 1)

  return node
\end{alltt}
\caption{Pseudo code of KD-Trees}\label{fig:pseudoCode-kd}
\end{figure}
