Created
March 1, 2015 05:29
-
-
Save frmsaul/7faf51d62ef6639f2492 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// your_objects is vector of pair<string, vector<int> > | |
// PQ is your priority_queue | |
int vector_counter = 0; | |
for(int i = 0; i < 10; i++){ | |
PQ.push(your_pairs[vector_counter]); | |
vector_counter++; | |
} | |
while(vector_counter < your_objects.size()){ | |
PQ.push(your_pairs[vector_counter]); | |
PQ.pop(); | |
vector_counter++; | |
} | |
//At the end of the day, PQ is gonna have the 10 "highest" elements |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment