title: Implementation of MergeSort algorithm using OpenMP
body: <p>I am trying to implement Mergesort algorithm using OpenMP for first time. I came across this block of code where they are using parallel sections directive to divide the unsorted array. But for Repeatedly merging the subarrays to produce new sorted array there is no parallel implementation. I have added the parallel directive for each loop in the merge method.Will this create the overhead on thread? I am not sure if this is right.Please correct me if I am wrong.How to proceed.Thanks.                       </p>
  
  <pre><code>void merge_divide(int array[],int low,int high)
  {
  int mid;
  if(low&lt;high)
  {
   mid=(low+high)/2;
   #pragma omp parallel sections
  {
  #pragma omp section
  {
  merge_divide(array,low,mid);
  }   
  #pragma omp section
  {
  merge_divide(array,mid+1,high);
  }
  }
  merge_conquer(array,low,mid,high);
  }
  
      Merge method 
      void merge_conquer(int array[],int low,int mid,int high)
  {
    int temp[30];
    int i,j,k,m;
    j=low;
    m=mid+1;
    #pragma omp parallel for
    for(i=low; j&lt;=mid &amp;&amp; m&lt;=high ; i++)
    {
       if(array[j]&lt;=array[m])
       {
           temp[i]=array[j];
           j++;
       }
       else
       {
           temp[i]=array[m];
           m++;
       }
    }
    if(j&gt;mid)
    {
      #pragma omp parallel for
       for(k=m; k&lt;=high; k++)
       {
           temp[i]=array[k];
           i++;
       }
    }
    else
    {
      #pragma omp parallel for
       for(k=j; k&lt;=mid; k++)
       {
          temp[i]=array[k];
          i++;
       }
    }
    #pragma omp parallel for
    for(k=low; k&lt;=high; k++)
       array[k]=temp[k];
  }
  </code></pre>