/**
 * Given a list of speed values and a threshold, this function sorts the values in ascending order and then filters
 * out the values that are below the threshold. The function returns a pair containing the sorted and filtered
 * speed values.
 *
 * @param speedData A list of speed values (doubles).
 * @param threshold A threshold value (double) below which the speed values will be filtered out.
 * @return A pair containing the sorted and filtered speed values (doubles).
 */
fun sortAndFilterSpeed(speedData: List<Double>, threshold: Double): Pair<List<Double>, List<Double>> {

    val sortedSpeeds = speedData.sorted()
    val filteredSpeeds = sortedSpeeds.filter { it >= threshold }
    return Pair(sortedSpeeds, filteredSpeeds)
}

// Example usage
/**
 * Given a list of speed values and a threshold, this function sorts the values in ascending order and then filters
 * out the values that are below the threshold. The function returns a pair containing the sorted and filtered
 * speed values.
 *
 * @param speedData A list of speed values (doubles).
 * @param threshold A threshold value (double) below which the speed values will be filtered out.
 * @return A pair containing the sorted and filtered speed values (doubles).
 */
fun sortAndFilterSpeed(speedData: List<Double>, threshold: Double): Pair<List<Double>, List<Double>> {
/**
 * Given a list of speed values and a threshold, this function sorts the values in ascending order and then filters
 * out the values that are below the threshold. The function returns a pair containing the sorted and filtered
 * speed values.
 *
 * @param speedData A list of speed values (doubles).
 * @param threshold A threshold value (double) below which the speed values will be filtered out.
 * @return A pair containing the sorted and filtered speed values (doubles).
 */
fun sortAndFilterSpeed(speedData: List<Double>, threshold: Double): Pair<List<Double>, List<Double>> {

    val sortedSpeeds = speedData.sorted()
    val filteredSpeeds = sortedSpeeds.filter { it >= threshold }
    return Pair(sortedSpeeds, filteredSpeeds)
}

// Example usage