Advertisement
Guest User

Untitled

a guest
Feb 25th, 2020
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.30 KB | None | 0 0
  1. void _insertionsort(vector<int> &a, int l, int r) {
  2. for (int i = l + 1; i < r; i++) {
  3. int j = i;
  4. while (j > l && a[j - 1] > a[j]) {
  5. swap(a[j - 1], a[j]);
  6. j--;
  7. }
  8. }
  9. }
  10. void insertionsort(vector<int> &a) {
  11. _insertionsort(a, 0, a.size());
  12. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement