added heap and top-k algorithm