Code Id | 26 | |
---|---|---|
Date Updated | 3/7/2010 | |
Title | Merge sort | |
Description | ||
This program implements merge sort. Merging is the process of combining two or more sorted files into a third sorted file. |
||
Codes Snippet | ||
merge(int a[], int n) { int temp,i ,j,k, l1, l2, size, u1, u2; size =1; while(size < n) { l1 = 0; k=0; while(l1+size=n) u2=n � 1; i = l1; j = l2; while( i<=u1 && j <= u2) if (a[i]<=a[j]) temp[k++]=a[i++]; else temp[k++]=a[j++]; while( i<=u1) temp[k++]=a[i++]; while( j<=u2) temp[k++]=a[j++]; l1 = u2 +1; } for( i=l1;k |
Online Enquiry
Course Registration
-
Recent Posts