Sort By Selection Algorithm By RECURSION

Posted on 2002-05-27
Last Modified: 2010-04-02
  I want the algorithm of :
       Sort By Selection function of a array of integer elements  
  SortBySelec(int a[]; int n);

Question by:RamiScience
LVL 31

Expert Comment

ID: 7038525

Accepted Solution

TheLord earned 200 total points
ID: 7038584
LVL 22

Expert Comment

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);

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

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…
Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

820 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