![]() |
Lesson | Selection Animation | Insertion Animation |
Student Toolkit - Selection Sort Simulation
Selection Sort animation to help visualize the sorting algorithm; meant to pair with student_toolkit sorting part 1 team teach lesson
Selection Sort Visualization
void selection_sort(int A[], int n) {
int minimum;
for(int i = 0; i < n-1; i++) {
minimum = i;
for(int j = i+1; j < n; j++) {
if(A[j] < A[minimum]) {
minimum = j;
}
}
swap(A[minimum], A[i]);
}
}