Sorting algorithm (modified merge sort) 
#define MaxSize 7000 
Algorithm (A , left, right, M, inter) 

//A is array of MaxSize elements, which need to be sorted from left to right position, M // is the number of processors, which 
will sort elements of array in parallel, inter is degree // of interleaving. 

factor = ()/Pow (M, inter); 
IF (factor > 3) THEN 

//This loop partitions the elements into M processors 

FOR ( to M DO) 
Sort Individual elements in the partitioned array with 
starting position as and end position till factor or 
, each element placed with “inter” positions 
next to previous elements. 
Merge (A, left, right, M, inter); 
ELSE 
InsertionSort (A, left, n, right, Pow (M, )); 
END 
Algorithm of insertion sort is modified so that each element is placed with “inter” positions next to previous element 
int j, p, Tmp, count; 
FOR (, ; count <, <= right; , ++count) 
Tmp = ; 
FOR (; >= && >= && []>Tmp; ) 
= []; 
; 
Modified Merge Algorithm 
Algorithm Merge (, left, right, , inter) 
{

pInter = Pow(, inter); 
FOR (; ; ++) pointer [] = left + r*pInter/M; 
= (); 
FOR to do 
FOR (; ; ) 
IF((pointer[] ) && (TmpArray[]>[pointer[])) 
TmpArray[] = A[pointer[]; 
indexJ = ; 
IF(pointer[index ] + pInter >) 
pointer[index ] = −1; 
ELSE pointer[index ] ; 
END For() 
FOR(; ; ) 
[] = TmpArray[]; 
}
