New Member FAQ | Forums | Earn Revenue


Resources Entrance Ask Experts Exam Papers Jobs English Projects Universities Colleges Courses Schools Training My India



My Profile
Active Members
TodayLast 7 Days more...



Awards & Gifts
Online Exams

Fresher Jobs


Our fresher job section is exclusively for fresh graduates! Find jobs for freshers in major Indian cities including Bangalore, Chennai, Hyderabad, Pune or Kochi

Resources


Find educational articles, blogs, discussion threads and other resources.

Colleges


Find details about any college in India or search for courses.

website counter



Merge Sort


Posted Date:     Total Responses: 0    Posted By: Rashina   Member Level: Gold   Points/Cash: 2   


# include
# include
#include

void merge(int k[],int low,int mid,int high)
{
int i = low,j = mid+1,h = low,temp[20];
while((i <= mid) && (j <= high))
{
if(k[i] <= k[j])
{
temp[h] = k[i];
i++;
}
else
{
temp[h] = k[j];
j++;
}
h++;
}
if(i > mid)
{
while(j <= high)
{
temp[h] = k[j];
j++;
h++;
}
}
else
{
while(i <= mid)
{
temp[h] = k[i];
i++;
h++;
}
}
for(i = low;i <= high;i++)
{
k[i] = temp[i];
}
clrscr();
cout <<"\nThe sorted array : ";
for(i = low;i <= high;i++)
{
cout < }
}

void mergesort(int k[],int low,int high)
{
int mid;
if(low < high)
{
mid = ((low + high)/2);
mergesort(k,low,mid);
mergesort(k,mid+1,high);
merge(k,low,mid,high);
}
}

void main()
{
int k[20],h;
clrscr();
cout <<"\nEnter the no. of elements : ";
cin >>h;
for(int i = 0;i < h;i++)
{
cout <<"\nEnter element no. "< cin >>k[i];
}
mergesort(k,0,h-1);
getch();
}


Project Feedbacks

Author: rajesh pandeyMember Level: BronzeRevenue Score: 1 out of 5
gud


Author: pintu singhMember Level: BronzeRevenue Score: 1 out of 5
i like your project


Post Feedback
You must Sign In to post a feedback.
Next Project: Writing Data in a File
Previous Project: WORKING OF UNICAST,MULTICAST,BROADCAST SESSIONS

Return to Project Index

Post New Project


Related Projects



Advertise Here





Contact Us   Advertise   Editors    Privacy Policy    Terms Of Use   

ISC Technologies.
2006 - 2009 All Rights Reserved.