I need a bit help here I have an array I need to sort in different threads. When the sorting is over, I get a few sublists of sorted elements, f.e.
-124.5 -9.03 0 13.2
-99.3 12.6 189.034 200.0
notice, there can be more sublists If there is any way I can merge these sublists into one saving the sorting order(From the smallest element to the biggest one) in resulted list?
SOLVED
used a piece of code from previous project
public static T[] ConcatArrs<T>(T[] left, T[] right) where T : System.IComparable<T>
{
T[] result = new T[left.Length + right.Length];
int lc = 0, rc = 0, i = 0;
for(i = 0; i < left.Length + right.Length; i++)
{
if (lc == left.Length)
{
result[i] = right[rc];
rc++;
continue;
}
if (rc == right.Length)
{
result[i] = left[lc];
lc++;
continue;
}
if (left[lc].CompareTo(right[rc]) <=0 )
result[i] = left[lc++];
else
result[i] = right[rc++];
}
return result;
}