Skip to content

Commit eb9113e

Browse files
authored
Merge pull request argonautica#43 from callmeanto/master
created folder for kotlin
2 parents d94b21b + dffcb4d commit eb9113e

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

Kotlin/selectionSort.kt

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
fun selectionSort(A:Array<Int>){
2+
var n = A.size
3+
var temp: Int
4+
for(i in n-1 downTo 0){
5+
var max = i
6+
for(j in 0 until i){
7+
if(A[j] > A[max])
8+
max = j
9+
}
10+
if(i != max){
11+
temp = A[i]
12+
A[i]= A[max]
13+
A[max] = temp
14+
}
15+
}
16+
}

0 commit comments

Comments
 (0)