Given $n$ rows with $k$ columns, is there a storage mechanism/data-structure and/or algorithm that enables dynamic restructuring such that I can get the top $t=\mathcal{O}(1)$ results efficiently?Example strategy 0$$k_0 \le k_1 \le \cdots \le k_{n-2} \le k_{n-1}$$Example strategy 1$$k_{n-1} \le k_{n-2} \le \cdots \le k_1 \le k_0$$Given [ [0,1] [2,3] [1,2] ] strategy 0 returns: [ [0,1], [1,2] ], where $t=2$.Restructuring with strategy 1 returns: [ [2,3], [1,2] ]. New strategies can be provided at runtime.Given a data-structure solution, here are the methods that it should expose:insert_row (*row) -> inserts a row of $k$ elements into the structuredelete_row (*row) -> delete the precisely specified row from structurenew_strategy(*k_prioritisation) -> rebalances the structure given the specified strategytop_rows() -> provides top rows after a strategy has been installed. Number of rows to return is specified at compile time (as a source-code constant).PS: Bonus points if you can enables strategies like $k_0 \le [\text{all other } k \text{ except } k_0]$, with embedded strategies of much the same.
Sorting tuples with respect to multiple criteria
algorithms;data structures;optimization;sorting;partitions