fun bubbleSort(list: MutableList<Int>) {
do {
var isSorted = true
for (i in 1 until list.size) {
if (list[i] < list[i - 1]) {
val temp = list[i]
list[i] = list[i - 1]
list[i - 1] = temp
isSorted = false
}
}
} while (!isSorted)
}
Last active
May 26, 2021 13:12
-
-
Save Alesh17/2af261d7c3c629018f3503cdeca0f9c1 to your computer and use it in GitHub Desktop.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment