public static<T extends Comparable<T>> void selectionSort(List<T>list) {
		if (!(list instanceof RandomAccess)) list=new ArrayList<>(list);
		for(int i=0,n=list.size(),imin=i;i<n;++i,imin=i) {
			for (int j=i;j<n;++j) if (list.get(j).compareTo(list.get(imin))<0) imin=j;
			Collections.swap(list,i,imin);
		}
	}