- 博客(1)
- 收藏
- 关注
原创 线性时间选择算法Randomized_Select
假设输入数据是互异的。Randomized_Select算法以快速排序算法为模型,可以求一个数组中第k小的元素。与快速排序不同的是,快速排序会递归处理划分的两边,而Randomized_Select只处理划分的一边,期望运行时间为O(n)。#include <iostream> #include <random> using namespace std; int Random(int p,int r
2015-09-13 23:16:56 2232
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人