Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <math.h>
- #include <stdio.h>
- void insertionSort(int arr[], int n)
- {
- int i, key, j;
- for (i = 1; i < n; i++) {
- key = arr[i];
- j = i - 1;
- while (j >= 0 && arr[j] > key) {
- arr[j + 1] = arr[j];
- j = j - 1;
- }
- arr[j + 1] = key;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement