Last updated 5 years ago
Was this helpful?
template <typename eType> void insertionSort(vector<eType> arr, int size) { int j, temp; for (int i = 1; i < size; i++) { j = i; while (j > 0 && arr[j] < arr[j - 1]) { temp = arr[j]; arr[j] = arr[j - 1]; arr[j - 1] = temp; j--; } } }