def reverse(array: Array[Int]) : List[Int] = { if(array.length < 2) array.toList val ab = new ArrayBuffer[Int]() for(i <- 0 until array.length; j <- -array.length+1 to 0;if(i-j) == array.length-1){ ab += array(-j) } ab.toList } val array = quickSort(List(10,5,11,23,556,45,332,78)).toArray[Int] println(array.toList) println(reverse(array))