Double findKthNum(Double[][] a, int left, int right, int k) {
    int index = partition(a, left, right);
    if (index + 1 == k) {
      return a[index][0];
    } else if (index + 1 < k) {
      return findKthNum(a, index + 1, right, k);
    } else {
      return findKthNum(a, left, index - 1, k);
    }
  }
This function is used to detect density anomaly of time series.
library-udf/src/main/java/org/apache/iotdb/library/anomaly/UDTFLOF.java