dynamically找最近m个数里最大的那个# JobHunting - 待字闺中
r*k
1 楼
咋做?
实际就是搜索引擎最近30分钟内频率最高的query吧?
我想到一个循环数组记堆内index
然后用堆存数值
每来一个新数,把新数放到要扔掉的老数的位置
然后update堆
不过index会变化比较多
实际就是搜索引擎最近30分钟内频率最高的query吧?
我想到一个循环数组记堆内index
然后用堆存数值
每来一个新数,把新数放到要扔掉的老数的位置
然后update堆
不过index会变化比较多