1. 一维无序数组(基本情形):用quick sort的partition容易实现,效率为O(n) 。
2.两个等长的有序数组(长度为n),求他们的中位数
见CLRS P193 9.3.8
扩展,两个不等长的数组求中位数
两个不等长的数组求第k大数
3.二维平面上有一些点,现要取一条水平线(平行于x轴),使得每个点到这条直线的距离加和最小。问这条水平线的位置?
只要取y轴的中位数即可
见CLRS P193 9.3.9
4. Young 矩阵中位数
1. 一维无序数组(基本情形):用quick sort的partition容易实现,效率为O(n) 。
2.两个等长的有序数组(长度为n),求他们的中位数
见CLRS P193 9.3.8
扩展,两个不等长的数组求中位数
两个不等长的数组求第k大数
3.二维平面上有一些点,现要取一条水平线(平行于x轴),使得每个点到这条直线的距离加和最小。问这条水平线的位置?
只要取y轴的中位数即可
见CLRS P193 9.3.9
4. Young 矩阵中位数