$heap->insert( $max); $heap->extract_min if $heap->size > $k;