Total members 10249 | Gratitudes |It is currently Thu May 17, 2012 7:48 am Login / Join Codemiles


All times are UTC [ DST ]




Post new topic Reply to topic  Quick reply  [ 1 post ] 
Author Question
 Question subject: C++ Recursion Sort
PostPosted: Sun May 25, 2008 3:44 pm 
Offline
Mastermind
User avatar

Joined: Tue Mar 27, 2007 10:55 pm
Posts: 2272
Location: Earth
Has thanked: 39 time
Have thanks: 61 time

This code for sorting an array using recursion function
Code:
#include<iostream.h>
int MAX(int a,int b)
{
   if(a>b)
      return a;
      return b;
      
}
int MAX(int a[],int SIZE )
{
   if(SIZE==1)return a[0];
   return MAX(a[SIZE-1],MAX(a,SIZE-1));
}
int[] Sort(int a[],int Size)
{
   int temp;
    temp=a[0]
   a[0]=MAX(a,Size);



   


   

}
void main()
{

   int a[6]={6,5,4,3,78,7};
   cout<<Sort(a,6)<<endl;



}


_________________
Currenlty programming with : java , html , php , and javascript . (OCJP-6 certified )


TOP
 Profile Send private message  
Reply with quote  
Post new topic Reply to topic Quick reply  [ 1 post ] 
Quick reply


  

 Similar topics
 NEED CODE OF find any num all divisor using recursion?
 Library Sort
 sort words in c++
 Help with selection sort for strings?
 factorial number Using Recursion
 Array sort
 Sort a list
 String Sort
 Quick Sort
 C++ Selection Sort

All times are UTC [ DST ]


Users browsing similar posts

Users browsing this forum: No registered users and 1 guest



Jump to:  
Previous Question | Next Question 




Home
General Talks
Finished Projects
Code Library
Games
Tutorials

Java
C/C++
C-sharp
php
Script
JSP/Servlets
Ajax
ASP/ASP.net
Google SEO
Database
Communications
Phpbb3 styles
Photoshop tutorials
Flash tutorials
Find a job






Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team