Switch to full style
For C/C++ coders discussions and solutions
Post a reply

C++ Recursion Sort

Sun May 25, 2008 3:44 pm

This code for sorting an array using recursion function
cpp 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;



}




Post a reply
  Related Posts  to : C++ Recursion Sort
 Function Recursion     -  
 factorial number Using Recursion     -  
 code to find a number all divisors using recursion     -  
 Insertion Sort (C++)     -  
 sort words in c++     -  
 Sort a list     -  
 C++ Bubble Sort     -  
 Array sort     -  
 C++ Selection Sort     -  
 Library Sort     -  

Topic Tags

C++ Sorting