Skip to content

Instantly share code, notes, and snippets.

@5AbhishekSaxena
Last active Jul 15, 2022
Embed
What would you like to do?
fun main() {
val numbers = arrayOf(4, 56, 12, 79, 25, 2)
sort(BubbleSortStrategy(), numbers) // Output: Numbers are sorted using Bubble sort.
sort(MergeSortStrategy(), numbers) // Output: Numbers are sorted using Merge sort.
}
fun sort(sortStrategy: SortStrategy, numbers: Array<Int>) {
sortStrategy.sort(numbers)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment