Solved

Sort By Selection Algorithm By RECURSION

Posted on 2002-05-27
3
167 Views
Last Modified: 2010-04-02
Hello
  I want the algorithm of :
       Sort By Selection function of a array of integer elements  
   by RECURSION .
 
  SortBySelec(int a[]; int n);
  {
  }

 Thanks.....................
0
Comment
Question by:RamiScience
3 Comments
 
LVL 31

Expert Comment

by:Zoppo
ID: 7038525
Homework?
0
 

Accepted Solution

by:
TheLord earned 200 total points
ID: 7038584
0
 
LVL 22

Expert Comment

by:ambience
ID: 7038623
void SortBySelec(int* a; int n);
{
    if(n == 1) retun;
    int j = 0;
    for(int i=1; i<n; i++)
       if(a[i] < a[0])
           j = i;
    a[0] = a[j];
    SortBySelec(&a[1], n-1);
}
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question