We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 8
MERGE SORTING
INTRODUCTION • Merge sort is one of the most popular sorting algorithms that is based on the principle of Divide and conquer algorithm.
• Here, a problem is divided into multiple sub-
problem. Each sub-problem is solved individually. finally ,sub-problem are combined to form the final solution. PROGRAM #include<stdio.h> #include<conio.h> #define n 6 Void mergesort(int[],int,int); Void merge(int[],int ,int ,int); Void main() { int x[20],i; clrscr(); Printf(“Enter the %d elements of the array:\n”); For(i=0;i<n;i++) Scanf(“%d”,&x[i]); Mergesort(x,0,n-1); Printf(“The sorted array is :”); For(i=0;i<n;i++) Printf(“%d->”,x[i]); getch(); } //mergesort function