#include #include using namespace std; const int n = 100; int a[n]; void selection_sort() { for (int i = 0; i < n - 1; i++) for (int j = i + 1; j < n; j++) if (a[i] > a[j]) swap(a[i], a[j]); } void bubble_sort() { for (int i = 0; i < n - 1; i++) for (int j = n - 1; j >= i + 1; j--) if (a[j - 1] > a[j]) swap(a[j - 1], a[j]); } void insertion_sort() { for (int i = 1; i < n; i++) for (int j = i; j > 0 && a[j - 1] > a[j]; j--) swap(a[j - 1], a[j]); } int main() { srand(time(NULL)); for (int i = 0; i < n; i++)a[i] = rand() % 100000; insertion_sort(); for (int i = 0; i < n; i++)cout << a[i] << " "; cout << endl; return 0; }