Kotlin
Kotlin copied to clipboard
Create pegionhole_sort.kt
Will do ASAP
On Sun 4 Oct, 2020, 5:37 PM Thibault Ballier, [email protected] wrote:
@tbmc commented on this pull request.
Please follow coding guidelines and add tests.
In src/main/kotlin/sort/pegionhole_sort.kt https://github.com/TheAlgorithms/Kotlin/pull/43#discussion_r499238151:
@@ -0,0 +1,43 @@ +import java.util.Arrays
Reformat the file
In src/main/kotlin/sort/pegionhole_sort.kt https://github.com/TheAlgorithms/Kotlin/pull/43#discussion_r499238191:
@@ -0,0 +1,43 @@ +import java.util.Arrays +fun pigeonhole_sort(arr: IntArray, n: Int):IntArray {
Bad naming style
In src/main/kotlin/sort/pegionhole_sort.kt https://github.com/TheAlgorithms/Kotlin/pull/43#discussion_r499238485:
+fun main(args: Array<String>) {
- val l = intArrayOf(-18,-2,12,23,4,2,6,1,0,-7,77)
- println(pigeonhole_sort(l, l.size).contentToString()) +}
Move this to test file and you could add other tests
In src/main/kotlin/sort/pegionhole_sort.kt https://github.com/TheAlgorithms/Kotlin/pull/43#discussion_r499238635:
- j = 0
- while (j < range) {
I think a for-loop is better suited
In src/main/kotlin/sort/pegionhole_sort.kt https://github.com/TheAlgorithms/Kotlin/pull/43#discussion_r499238678:
- i = 0
- while (i < n) {
I think a for-loop is better suited
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/TheAlgorithms/Kotlin/pull/43#pullrequestreview-501616200, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQAIA4YYZYTB7R4SA6QBYV3SJBQOJANCNFSM4SCAJBKA .
sir I, have made the necessary changes. Please review them. thank you