How I can merge effectively more sorted subarray to one array. (So as haven't to create new array with same size.)
I have got array:
int LENGHT = 12;
int ARRAY[LENGHT] = {5,8,6,3,48,65,1,8,9,20,21,57};
For example bubble sort in fourth thread:
int ARRAY[LENGHT] = {5,8,6,3,48,65,1,8,9,20,57,21};
thread_1 -> BubbleSort(0, LENGTH/4, ARRAY);
thread_2 -> BubbleSort(LENGTH/4, LENGTH/2, ARRAY);
thread_3 -> BubbleSort(LENGTH/2, (3*LENGTH)/4, ARRAY);
thread_4 -> BubbleSort((3*LENGTH)/4, LENGTH, ARRAY);
I get:
ARRAY[] = {3,5,6, 1,8,8, 9,45,65, 20,21,57};
What is the best way to merging to one array?
{3,5,6, 1,8,8, 9,45,65, 20,21,57} -> {1,3,5, 6,8,8, 9,20,21, 45,57,65}