You are viewing a single comment's thread. Return to all comments →
void insertionSort2(int n, vector arr) {
for(int i=1; i<n; i++){ for(int j=i-1; j>=0;j--){ if(arr[j+1]<arr[j]){ int x = arr[j]; arr[j] = arr[j+1]; arr[j+1] = x; } } for(int l = 0; l<n ; l++){ cout<<arr[l]<<" "; } cout<<endl; }
}
Insertion Sort - Part 2
You are viewing a single comment's thread. Return to all comments →
C++ solution
void insertionSort2(int n, vector arr) {
}