Two months ago, I came across a problem. Initially there are n elements, they are in n tiles. There are 3 kinds of queries: 1. merge two tiles into one tile. 2. split one tile into two tiles. (Formally for a tile of size k, split it into two tiles of size k1 and k2, k=k1+k2, the first tile contains the smallest k1 elements and the second tile contains the rest) 3. find the k-th smallest element in one tile. I posted this problem in stackoverflow but no one answered :/ Recently I found this technique http://blog.csdn.net/zawedx/article/details/51818475 (in Chinese) which can be used to solve this problem.