.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Code Snippets >> Collections >> Post New Resource Bookmark and Share   

 Subscribe to Code Snippets

Merge sort

Posted By:Nikhil Kumar       Posted Date: February 28, 2010    Points: 10    Category: Collections    URL: http://www.dotnetspark.com  

merge sort in c
 

#include
#include
#include
#include
void main()
{
int rang1[5],rang2[5],rang3[10];
for(i=0;i<5;i++)
cin>>rang1[i];
for(i=0;i<5;i++)
cin>>rang2[i];
               while(i<10&&j<5)
               {
                  if(rang1[i]
                  {
                  rang3[k]=rang1[j];
                  k=k+1;
                  i=i+1;
                  }
                  else
                  {
                  rang3[k]=rang2[j];
                  k=k+1;
                  j=j+1;
               }
while(i<=10)
{
rang3[k]=rang1[i];
k=k+1;
i=i+1;
}
while(j<=n)
{
rang3[k]=rang2[j];
k=k+1;
j=j+1;
t=m+n;
}


     

Further Readings:

Responses

No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More code samples in C#, ASP.Net, Vb.Net and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend