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(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