docs: protected void buildKDTree(Instances instances) throws Exception {
  
      checkMissing(instances);
      if (m_EuclideanDistance == null)
        m_DistanceFunction = m_EuclideanDistance = new EuclideanDistance(
            instances);
      else
        m_EuclideanDistance.setInstances(instances);
  
      m_Instances = instances;
      int numInst = m_Instances.numInstances();
  
      // Make the global index list
      m_InstList = new int[numInst];
  
      for (int i = 0; i < numInst; i++) {
        m_InstList[i] = i;
      }
  
      double[][] universe = m_EuclideanDistance.getRanges();
  
      // initializing internal fields of KDTreeSplitter
      m_Splitter.setInstances(m_Instances);
      m_Splitter.setInstanceList(m_InstList);
      m_Splitter.setEuclideanDistanceFunction(m_EuclideanDistance);
      m_Splitter.setNodeWidthNormalization(m_NormalizeNodeWidth);
  
      // building tree
      m_NumNodes = m_NumLeaves = 1;
      m_MaxDepth = 0;
      m_Root = new KDTreeNode(m_NumNodes, 0, m_Instances.numInstances() - 1,
          universe);
  
      splitNodes(m_Root, universe, m_MaxDepth + 1);
    }