Insertion Sort, Algorithms, Data Structure Algorithm, Coding Interviews, Job Hunting.
sorted array. #include <iostream> using namespace std; void insertion_sort(int a[], int n) { int key; for (int i = 1; i < n; i++) { key = a[i]; int j; for (j = i - 1; j >= 0; j--) { //Comparing key with elements of sorted array if (a[j] > key) { a[j + 1] = a[j]; } else break; } //Setting key at