Total members 11895 |It is currently Sun Dec 22, 2024 4:06 am Login / Join Codemiles

Java

C/C++

PHP

C#

HTML

CSS

ASP

Javascript

JQuery

AJAX

XSD

Python

Matlab

R Scripts

Weka





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;



}




_________________
M. S. Rakha, Ph.D.
Queen's University
Canada


Author:
Mastermind
User avatar Posts: 2715
Have thanks: 74 time
Post new topic Reply to topic  [ 1 post ] 

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



Topic Tags

C++ Sorting
cron





Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com