Last active
January 9, 2016 14:44
-
-
Save Zekt/b300df04e90b7e1fc5c7 to your computer and use it in GitHub Desktop.
Split a vector into fixed-size blocks and handle remaining objects. #Iterate #Split #Block
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
int* input = new int[num]; | |
vector<thread> threads; | |
int i; | |
for(i = 0; i+segment_size < num; i += segment_size) | |
threads.push_back(thread(sort_segment, input+i, segment_size)); | |
if(num-i > 0) | |
threads.push_back(thread(sort_segment, input+i, num-i)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment