-
-
Save 5AbhishekSaxena/cc0c5c1afd01030ed2ebbfbc1152a0f3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun main() { | |
val numbers = arrayOf(4, 56, 12, 79, 25, 2) | |
sort("Bubble", numbers) | |
} | |
fun sort(algorithm: String, numbers: Array<Int>) { | |
if (algorithm == "Bubble") { | |
println("Numbers are sorted using Bubble sort.") | |
// bubble sort algorithm | |
} else if (algorithm == "Merge") { | |
println("Numbers are sorted using Merge sort.") | |
// merge sort algorithm | |
} else { | |
throw IllegalArgumentException() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment