All pastes #414947 Raw Edit

Stuff

public text v1 · immutable
#414947 ·published 2007-03-29 12:47 UTC
rendered paste body
void merge(int *x, int p, int q, int r)
{
	int i=p,j=q+1,k=0,temp[100];
	while (i<=q && j<=r)
		if (x[i]<x[j])
			temp[k++]=x[i++];
			
		else
			temp[k++]=x[j++];		
	while (i<=q) temp[k++]=x[i++];
	while (j<=r) temp[k++]=x[j++];
	for (i=p;i<=r;i++)
		x[i]=temp[i-p];
}