**插入排序
**在这里插入代码片
// scal 函数式编程实现插入排序
def insertSortByFunction[A <% Ordered[A]](list:List[A]):List[A]={
def insertSort(unSort:List[A], sort:List[A]):List[A]=unSort match{
case head::tail =>insertSort(tail,insert(head,sort))
case Nil => sort
}
def insert(a: A, sort: List[A]):List[A]=sort match{
case head :: tail if(a>head) => head :: insert(a,tail)
case _ => a::sort
}
insertSort(list,Nil)
}
//java 思想编程
def insertSort(arr:Array[Int]): Unit ={
for(i <- 1 to arr.length -1){ //[1,arr.length-1]
breakable{
for(j <- 1 to i reverse){ //[1,i] until[1,i)
if(arr(j)<arr(j-1)){
arr(j)=arr(j-1)^arr(j)
arr(j-1)=arr(j-1)^arr(j)
arr(j)=arr(j-1)^arr(j)
} else{
br