Skip to content

Commit

Permalink
Add a comment (add information to complete the picture, to connect th…
Browse files Browse the repository at this point in the history
…e dots) for 060quickSort1.kt
  • Loading branch information
sagarpatel288 committed Oct 15, 2024
1 parent efbdbdc commit 4f0e1df
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/level40Module4AlgorithmExercise/060quickSort1.kt
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,10 @@ fun main() {
fun getPartitionIndex(input: IntArray, start: Int, end: Int): Int {
getPartitionIndexFunCount++
val pivot = input[end]
// We want to start the marker confirmation from the [start] index position for the given range.
// The [start] index position does not have to be 0 always.
// Because, we may get different ranges for the different parts (left, and right) of the given input array.
// So, we don't start the marker index from -1. We start from [start] - 1.
var partitionIndex = start - 1
println(": :getPartitionIndex: funCount: $getPartitionIndexFunCount input: ${input.toList()} start: $start end: $end pivot: $pivot initialPartitionIndex: $partitionIndex")
for (j in start..<end) {
Expand Down

0 comments on commit 4f0e1df

Please sign in to comment.