Answer the question
In order to leave comments, you need to log in
What is this function?
What is this C++ function? What is the name of the algorithm?
void SortArr(int arr[], int n) {
for (int startIndex = 0; startIndex < n - 1; ++startIndex) {
int smallestIndex = startIndex;
for (int currentIndex = startIndex + 1; currentIndex < n; ++currentIndex) {
if (arr[currentIndex] < arr[smallestIndex]) {
smallestIndex = currentIndex;
}
}
swap(arr[startIndex], arr[smallestIndex]);
}
}
Answer the question
In order to leave comments, you need to log in
Read the descriptions of the algorithms , look for the one that matches the code shown.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question