fun oddEvenSort(array: MutableList<Int>) {
for (i in array.indices) {
for (j in i % 2 + 1 until array.count() step 2) {
if (array[j] < array[j - 1]) {
val tmp = array[j]
array[j] = array[j - 1]
array[j - 1] = tmp
}
}
}
}
fun main() {
val array = mutableListOf(7, 3, 0, 1, 5, 2, 5, 19, 10, 5)
oddEvenSort(array)
println(array)
}
ZnVuIG9kZEV2ZW5Tb3J0KGFycmF5OiBNdXRhYmxlTGlzdDxJbnQ+KSB7CiAgICBmb3IgKGkgaW4gYXJyYXkuaW5kaWNlcykgewogICAgICAgIGZvciAoaiBpbiBpICUgMiArIDEgdW50aWwgYXJyYXkuY291bnQoKSBzdGVwIDIpIHsKICAgICAgICAgICAgaWYgKGFycmF5W2pdIDwgYXJyYXlbaiAtIDFdKSB7CiAgICAgICAgICAgICAgICB2YWwgdG1wID0gYXJyYXlbal0KICAgICAgICAgICAgICAgIGFycmF5W2pdID0gYXJyYXlbaiAtIDFdCiAgICAgICAgICAgICAgICBhcnJheVtqIC0gMV0gPSB0bXAKICAgICAgICAgICAgfQogICAgICAgIH0KICAgIH0KfQoKZnVuIG1haW4oKSB7CiAgICB2YWwgYXJyYXkgPSBtdXRhYmxlTGlzdE9mKDcsIDMsIDAsIDEsIDUsIDIsIDUsIDE5LCAxMCwgNSkKCiAgICBvZGRFdmVuU29ydChhcnJheSkKCiAgICBwcmludGxuKGFycmF5KQp9