variants of median

1. 一维无序数组(基本情形):用quick sort的partition容易实现,效率为O(n) 。


2.两个等长的有序数组(长度为n),求他们的中位数 

见CLRS P193 9.3.8


扩展,两个不等长的数组求中位数

两个不等长的数组求第k大数


3.二维平面上有一些点,现要取一条水平线(平行于x轴),使得每个点到这条直线的距离加和最小。问这条水平线的位置?

只要取y轴的中位数即可 

见CLRS P193 9.3.9


4. Young 矩阵中位数

This error message indicates that there is a conflict between different variants of the `org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.0` dependency that your project is trying to use. The consumer was configured to find a runtime of a component compatible with Java 11, packaged as a jar, and its dependencies declared externally, but it cannot choose between the available variants of the dependency. To resolve this issue, you can try the following steps: - Check if your project is explicitly declaring a version of the `org.jetbrains.kotlin:kotlin-gradle-plugin` dependency that conflicts with the version required by the consumer (in this case, Java 11). If so, try updating the project to use the correct version of the dependency. - If the above step does not work, you can try adding a resolution strategy to your build script to force Gradle to choose the correct variant of the dependency. For example, you can add the following code to your `build.gradle` file: ``` configurations.all { resolutionStrategy { eachDependency { DependencyResolveDetails details -> if (details.requested.group == 'org.jetbrains.kotlin' && details.requested.name == 'kotlin-gradle-plugin' && details.requested.version == '1.7.0') { details.useVersion('1.7.0') } } } } ``` This code tells Gradle to use version `1.7.0` of the `org.jetbrains.kotlin:kotlin-gradle-plugin` dependency whenever it is required, regardless of any conflicting versions that may be present. If neither of these steps work, you may need to investigate further to find the root cause of the conflict.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值