Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static long insertionSort(int[] list) {
- int i, j, key;
- for(j = 1; j < list.length; j++) {
- key = list[j];
- for(i = j - 1; (i >= 0) && (list[i] > key); i--) {
- list[i + 1] = list[i];
- }
- list[i + 1] = key;
- }
- return list;
- }
Advertisement
Add Comment
Please, Sign In to add comment