子序列的最大几个值 maximum k elements in a subarray
U have given large stream of m size and you have size of n window . you have to find the k minimum in each window . we are shifting the window by one at every iteration.
解答: I have used self balancing tree.First i have entered n element in tree and do in order traversal upto k to find k minimum element.Now shift the window by one .Now we to remove first element(logn time req) and insert the new element(logn time).
注意:C++的STL里的set是用binary search tree实现的,到底是不是balanced binary search tree,这个不一定。但是通常情况下,是红黑树,所以就是平衡树。