I need to implement an algorithm for parallel selection sort using OpenMP, although I couldn't find much information either on SO or on the Internet in general.
Here's my serial code:
void selectionsort(int* arr, int size)
{
for (int i = size - 1; i > 0; --i)
{
int max = i;
for (int j = i - 1; j >= 0; --j)
{
if (arr[j] > arr[max])
{
max = j;
}
}
swap(arr[i], arr[max]);
}
}
Does anybody know how to implement this type of sorting algorithm in parallel? At least in theory?
pragma ompon the inner loop which could be parallelized easily.