一 插值排序
public class Insertion {
public static void sort(int[] a)
{ int N = a.length;
for(int i = 1; i < N; i++) { for (int j = i; j > 0 && a[j] < a[j - 1]; j --) {exch(a, j, j-1);}}}private void exch(int[] a, int i, int j) {int t=a[i]; a[i]=a[j]; a[j]=t;}}
二 選択ソート
public class selection{public static void sort(int[] a) {
int N = a.length; for(int i = 0; i < N; i++) {int min = i; for(int j = i + 1; j < N; j++) { if(a[j] < a[min]){min=j;}exch(a, i, min);}}private void exch(int[] a, int i, int j) {int t=a[i]; a[i]=a[j]; a[j]=t;}}
Check dragon's spell
Teach her a matching spell
leave this place
meet the dragon