Date post: | 21-Dec-2015 |
Category: |
Documents |
View: | 221 times |
Download: | 2 times |
För algoritm, se figur 6.9i Java Gently, sidan 179
4
0
3
1
8
2
2
3
9
4
2
5
4
6
5
7
leftmost
chosen
j
a
temp
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
4
0
3
1
8
2
2
3
9
4
2
5
4
6
5
7
0leftmost
0chosen
j
a
temp
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
4
0
3
1
8
2
2
3
9
4
2
5
4
6
5
7
0leftmost
0chosen
1j
a
temp
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
4
0
3
1
8
2
2
3
9
4
2
5
4
6
5
7
0leftmost
0chosen
1j
a
temp
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
4
0
3
1
8
2
2
3
9
4
2
5
4
6
5
7
0leftmost
0chosen
1j
a
SANT
temp
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
4
0
3
1
8
2
2
3
9
4
2
5
4
6
5
7
0leftmost
1chosen
1j
a
temp
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
4
0
3
1
8
2
2
3
9
4
2
5
4
6
5
7
0leftmost
1chosen
2j
a
temp
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
4
0
3
1
8
2
2
3
9
4
2
5
4
6
5
7
0leftmost
1chosen
2j
a
temp
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
4
0
3
1
8
2
2
3
9
4
2
5
4
6
5
7
0leftmost
1chosen
2j
a
Falskt
temp
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
4
0
3
1
8
2
2
3
9
4
2
5
4
6
5
7
0leftmost
1chosen
3j
a
temp
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
4
0
3
1
8
2
2
3
9
4
2
5
4
6
5
7
0leftmost
1chosen
3j
a
temp
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
4
0
3
1
8
2
2
3
9
4
2
5
4
6
5
7
0leftmost
1chosen
3j
a
Sant
temp
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
4
0
3
1
8
2
2
3
9
4
2
5
4
6
5
7
0leftmost
3chosen
3j
a
temp
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
4
0
3
1
8
2
2
3
9
4
2
5
4
6
5
7
0leftmost
3chosen
4j
a
temp
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
4
0
3
1
8
2
2
3
9
4
2
5
4
6
5
7
0leftmost
3chosen
4j
a
temp
Falskt
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
4
0
3
1
8
2
2
3
9
4
2
5
4
6
5
7
0leftmost
3chosen
5j
a
temp
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
4
0
3
1
8
2
2
3
9
4
2
5
4
6
5
7
0leftmost
3chosen
5j
a
temp
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
4
0
3
1
8
2
2
3
9
4
2
5
4
6
5
7
0leftmost
3chosen
5j
a
temp
Falskt
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
4
0
3
1
8
2
2
3
9
4
2
5
4
6
5
7
0leftmost
3chosen
6j
a
temp
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
4
0
3
1
8
2
2
3
9
4
2
5
4
6
5
7
0leftmost
3chosen
6j
a
temp
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
4
0
3
1
8
2
2
3
9
4
2
5
4
6
5
7
0leftmost
3chosen
6j
a
temp
Falskt
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
4
0
3
1
8
2
2
3
9
4
2
5
4
6
5
7
0leftmost
3chosen
6j
a
temp
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
4
0
3
1
8
2
2
3
9
4
2
5
4
6
5
7
0leftmost
3chosen
6j
a
temp
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
4
0
3
1
8
2
2
3
9
4
2
5
4
6
5
7
0leftmost
3chosen
6j
a
temp
FalsktFalskt
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
4
0
3
1
8
2
2
3
9
4
2
5
4
6
5
7
0leftmost
3chosen
6j
a
2temp
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
4
0
3
1
8
2
4
3
9
4
2
5
4
6
5
7
0leftmost
3chosen
6j
a
2temp
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
2
0
3
1
8
2
4
3
9
4
2
5
4
6
5
7
0leftmost
3chosen
6j
a
2temp
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
2
0
3
1
8
2
4
3
9
4
2
5
4
6
5
7
1leftmost
3chosen
6j
a
2temp
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
2
0
3
1
8
2
4
3
9
4
2
5
4
6
5
7
1leftmost
1chosen
6j
a
2temp
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
2
0
3
1
8
2
4
3
9
4
2
5
4
6
5
7
1leftmost
1chosen
2j
a
2temp
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
2
0
3
1
8
2
4
3
9
4
2
5
4
6
5
7
1leftmost
1chosen
2j
a
2temp
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
2
0
3
1
8
2
4
3
9
4
2
5
4
6
5
7
1leftmost
1chosen
2j
a
2temp
Falskt
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
2
0
3
1
8
2
4
3
9
4
2
5
4
6
5
7
1leftmost
1chosen
3j
a
2temp
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
2
0
3
1
8
2
4
3
9
4
2
5
4
6
5
7
1leftmost
1chosen
3j
a
2temp
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
2
0
3
1
8
2
4
3
9
4
2
5
4
6
5
7
1leftmost
1chosen
3j
a
2temp
Falskt
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
2
0
3
1
8
2
4
3
9
4
2
5
4
6
5
7
1leftmost
1chosen
4j
a
2temp
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
2
0
3
1
8
2
4
3
9
4
2
5
4
6
5
7
1leftmost
1chosen
4j
a
2temp
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
2
0
3
1
8
2
4
3
9
4
2
5
4
6
5
7
1leftmost
1chosen
4j
a
2temp
Falskt
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
2
0
3
1
8
2
4
3
9
4
2
5
4
6
5
7
1leftmost
1chosen
5j
a
2temp
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
2
0
3
1
8
2
4
3
9
4
2
5
4
6
5
7
1leftmost
1chosen
5j
a
2temp
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
2
0
3
1
8
2
4
3
9
4
2
5
4
6
5
7
1leftmost
1chosen
5j
a
2temp
Sant
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
2
0
3
1
8
2
4
3
9
4
2
5
4
6
5
7
1leftmost
5chosen
5j
a
2temp
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
2
0
3
1
8
2
4
3
9
4
2
5
4
6
5
7
1leftmost
5chosen
6j
a
2temp
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
2
0
3
1
8
2
4
3
9
4
2
5
4
6
5
7
1leftmost
5chosen
6j
a
2temp
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
2
0
3
1
8
2
4
3
9
4
2
5
4
6
5
7
1leftmost
5chosen
6j
a
2temp
Falskt
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
2
0
3
1
8
2
4
3
9
4
2
5
4
6
5
7
1leftmost
5chosen
7j
a
2temp
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
2
0
3
1
8
2
4
3
9
4
2
5
4
6
5
7
1leftmost
5chosen
7j
a
2temp
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
2
0
3
1
8
2
4
3
9
4
3
5
4
6
5
7
1leftmost
5chosen
7j
a
2temp
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
2
0
2
1
8
2
4
3
9
4
3
5
4
6
5
7
1leftmost
5chosen
7j
a
2temp
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
2
0
2
1
8
2
4
3
9
4
3
5
4
6
5
7
2leftmost
5chosen
7j
a
2temp
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
2
0
2
1
8
2
4
3
9
4
3
5
4
6
5
7
2leftmost
2chosen
7j
a
2temp
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
2
0
2
1
8
2
4
3
9
4
3
5
4
6
5
7
2leftmost
2chosen
3j
a
2temp
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
2
0
2
1
8
2
4
3
9
4
3
5
4
6
5
7
2leftmost
2chosen
3j
a
2temp
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
2
0
2
1
8
2
4
3
9
4
3
5
4
6
5
7
2leftmost
2chosen
3j
a
2temp
SANT
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
2
0
2
1
8
2
4
3
9
4
3
5
4
6
5
7
2leftmost
3chosen
3j
a
2temp
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
2
0
2
1
8
2
4
3
9
4
3
5
4
6
5
7
2leftmost
3chosen
4j
a
2temp
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
2
0
2
1
8
2
4
3
9
4
3
5
4
6
5
7
2leftmost
3chosen
4j
a
2temp
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
2
0
2
1
8
2
4
3
9
4
3
5
4
6
5
7
2leftmost
3chosen
4j
a
2temp
FALSKT
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
2
0
2
1
8
2
4
3
9
4
3
5
4
6
5
7
2leftmost
3chosen
5j
a
2temp
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
2
0
2
1
8
2
4
3
9
4
3
5
4
6
5
7
2leftmost
3chosen
5j
a
2temp
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
2
0
2
1
8
2
4
3
9
4
3
5
4
6
5
7
2leftmost
3chosen
5j
a
2temp
Sant
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
2
0
2
1
8
2
4
3
9
4
3
5
4
6
5
7
2leftmost
5chosen
5j
a
2temp
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
2
0
2
1
8
2
4
3
9
4
3
5
4
6
5
7
2leftmost
5chosen
6j
a
2temp
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
2
0
2
1
8
2
4
3
9
4
3
5
4
6
5
7
2leftmost
5chosen
6j
a
2temp
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
2
0
2
1
8
2
4
3
9
4
3
5
4
6
5
7
2leftmost
5chosen
6j
a
2temp
Falskt
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
2
0
2
1
8
2
4
3
9
4
3
5
4
6
5
7
2leftmost
5chosen
7j
a
2temp
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
2
0
2
1
8
2
4
3
9
4
3
5
4
6
5
7
2leftmost
5chosen
7j
a
3temp
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
2
0
2
1
8
2
4
3
9
4
8
5
4
6
5
7
2leftmost
5chosen
7j
a
3temp
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
2
0
2
1
3
2
4
3
9
4
8
5
4
6
5
7
2leftmost
5chosen
7j
a
3temp
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
2
0
2
1
3
2
4
3
9
4
8
5
4
6
5
7
3leftmost
5chosen
7j
a
3temp
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
2
0
2
1
3
2
4
3
9
4
8
5
4
6
5
7
3leftmost
3chosen
7j
a
3temp
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
2
0
2
1
3
2
4
3
9
4
8
5
4
6
5
7
3leftmost
3chosen
4j
a
3temp
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
2
0
2
1
3
2
4
3
9
4
8
5
4
6
5
7
3leftmost
3chosen
4j
a
3temp
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
2
0
2
1
3
2
4
3
9
4
8
5
4
6
5
7
3leftmost
3chosen
4j
a
3temp
FALSKT
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
2
0
2
1
3
2
4
3
9
4
8
5
4
6
5
7
3leftmost
3chosen
5j
a
3temp
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
2
0
2
1
3
2
4
3
9
4
8
5
4
6
5
7
3leftmost
3chosen
5j
a
3temp
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
2
0
2
1
3
2
4
3
9
4
8
5
4
6
5
7
3leftmost
3chosen
5j
a
3temp
FALSKT
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
2
0
2
1
3
2
4
3
9
4
8
5
4
6
5
7
3leftmost
3chosen
6j
a
3temp
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
2
0
2
1
3
2
4
3
9
4
8
5
4
6
5
7
3leftmost
3chosen
6j
a
3temp
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
2
0
2
1
3
2
4
3
9
4
8
5
4
6
5
7
3leftmost
3chosen
6j
a
3temp
FALSKT
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
2
0
2
1
3
2
4
3
9
4
8
5
4
6
5
7
3leftmost
3chosen
7j
a
3temp
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
2
0
2
1
3
2
4
3
9
4
8
5
4
6
5
7
3leftmost
3chosen
7j
a
3temp
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
2
0
2
1
3
2
4
3
9
4
8
5
4
6
5
7
3leftmost
3chosen
7j
a
3temp
FALSKT
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
2
0
2
1
3
2
4
3
9
4
8
5
4
6
5
7
3leftmost
3chosen
7j
a
4temp
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
2
0
2
1
3
2
4
3
9
4
8
5
4
6
5
7
3leftmost
3chosen
7j
a
4temp
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
2
0
2
1
3
2
4
3
9
4
8
5
4
6
5
7
3leftmost
3chosen
7j
a
4temp
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
2
0
2
1
3
2
4
3
9
4
8
5
4
6
5
7
4leftmost
3chosen
7j
a
4temp
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
2
0
2
1
3
2
4
3
9
4
8
5
4
6
5
7
4leftmost
4chosen
7j
a
4temp
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
2
0
2
1
3
2
4
3
9
4
8
5
4
6
5
7
4leftmost
4chosen
5j
a
4temp
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
2
0
2
1
3
2
4
3
9
4
8
5
4
6
5
7
4leftmost
4chosen
5j
a
4temp
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
2
0
2
1
3
2
4
3
9
4
8
5
4
6
5
7
4leftmost
4chosen
5j
a
4temp
Sant
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
2
0
2
1
3
2
4
3
9
4
8
5
4
6
5
7
4leftmost
5chosen
5j
a
4temp
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
2
0
2
1
3
2
4
3
9
4
8
5
4
6
5
7
4leftmost
5chosen
6j
a
4temp
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
2
0
2
1
3
2
4
3
9
4
8
5
4
6
5
7
4leftmost
5chosen
6j
a
4temp
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
2
0
2
1
3
2
4
3
9
4
8
5
4
6
5
7
4leftmost
5chosen
6j
a
4temp
Sant
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
2
0
2
1
3
2
4
3
9
4
8
5
4
6
5
7
4leftmost
6chosen
6j
a
4temp
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
2
0
2
1
3
2
4
3
9
4
8
5
4
6
5
7
4leftmost
6chosen
7j
a
4temp
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
2
0
2
1
3
2
4
3
9
4
8
5
4
6
5
7
4leftmost
6chosen
7j
a
4temp
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
2
0
2
1
3
2
4
3
9
4
8
5
4
6
5
7
4leftmost
6chosen
7j
a
4temp
Falskt
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
2
0
2
1
3
2
4
3
9
4
8
5
4
6
5
7
4leftmost
6chosen
7j
a
4temp
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
2
0
2
1
3
2
4
3
9
4
8
5
9
6
5
7
4leftmost
6chosen
7j
a
4temp
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
2
0
2
1
3
2
4
3
4
4
8
5
9
6
5
7
4leftmost
6chosen
7j
a
4temp
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
2
0
2
1
3
2
4
3
4
4
8
5
9
6
5
7
5leftmost
6chosen
7j
a
4temp
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
2
0
2
1
3
2
4
3
4
4
8
5
9
6
5
7
5leftmost
5chosen
7j
a
4temp
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
2
0
2
1
3
2
4
3
4
4
8
5
9
6
5
7
5leftmost
5chosen
6j
a
4temp
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
2
0
2
1
3
2
4
3
4
4
8
5
9
6
5
7
5leftmost
5chosen
6j
a
4temp
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
2
0
2
1
3
2
4
3
4
4
8
5
9
6
5
7
5leftmost
5chosen
6j
a
4temp
Falskt
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
2
0
2
1
3
2
4
3
4
4
8
5
9
6
5
7
5leftmost
5chosen
7j
a
4temp
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
2
0
2
1
3
2
4
3
4
4
8
5
9
6
5
7
5leftmost
5chosen
7j
a
4temp
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
2
0
2
1
3
2
4
3
4
4
8
5
9
6
5
7
5leftmost
5chosen
7j
a
4temp
Sant
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
2
0
2
1
3
2
4
3
4
4
8
5
9
6
5
7
5leftmost
5chosen
7j
a
4temp
Sant
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
2
0
2
1
3
2
4
3
4
4
8
5
9
6
5
7
5leftmost
5chosen
7j
a
5temp
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
2
0
2
1
3
2
4
3
4
4
8
5
9
6
8
7
5leftmost
5chosen
7j
a
5temp
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
2
0
2
1
3
2
4
3
4
4
5
5
9
6
8
7
5leftmost
5chosen
7j
a
5temp
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
2
0
2
1
3
2
4
3
4
4
5
5
9
6
8
7
6leftmost
5chosen
7j
a
5temp
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
2
0
2
1
3
2
4
3
4
4
5
5
9
6
8
7
6leftmost
6chosen
7j
a
5temp
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
2
0
2
1
3
2
4
3
4
4
5
5
9
6
8
7
6leftmost
6chosen
7j
a
5temp
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
2
0
2
1
3
2
4
3
4
4
5
5
9
6
8
7
6leftmost
6chosen
7j
a
5temp
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
2
0
2
1
3
2
4
3
4
4
5
5
9
6
8
7
6leftmost
6chosen
7j
a
5temp
Sant
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
2
0
2
1
3
2
4
3
4
4
5
5
9
6
8
7
6leftmost
7chosen
7j
a
5temp
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
2
0
2
1
3
2
4
3
4
4
5
5
9
6
8
7
6leftmost
7chosen
7j
a
8temp
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
2
0
2
1
3
2
4
3
4
4
5
5
9
6
9
7
6leftmost
7chosen
7j
a
8temp
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
2
0
2
1
3
2
4
3
4
4
5
5
8
6
9
7
6leftmost
7chosen
7j
a
8temp
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
2
0
2
1
3
2
4
3
4
4
5
5
8
6
9
7
6leftmost
7chosen
7j
a
8temp
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}
2
0
2
1
3
2
4
3
4
4
5
5
8
6
9
7
leftmost
chosen
j
a
temp
FÄRDIGSORTERAT
Static void selectionSort(int[] a, int n){ int temp; int chosen; for(int leftmost = 0: leftmost < n-1. Leftmost++) { chosen = leftmost; for(int j = leftmost + 1; j < n; j++) if(a[j] < a[chosen]) chosen = j; temp = a[chosen]; a[chosen] = a[leftmost]; a[leftmost] = temp; }}