Generalized max-value data structure