Skip to content

Commit a1779ca

Browse files
changed conflicting function name
1 parent 7f46135 commit a1779ca

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/main/scala/algorithms/sort/TimSort.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ def timSort(arr: Array[Int], k: Int = 64): Unit = {
1212

1313
val n = arr.length
1414

15-
// Step 1: Sort small chunks with Insertion Sort
15+
// Sort small chunks with Insertion Sort
1616
for (i <- 0 until n by k) {
1717
val end = Math.min(i + k, n)
18-
insertionSortInPlace(arr, i, end)
18+
subArrayInsertionSort(arr, i, end)
1919
}
2020

21-
// Step 2: Merge sorted chunks with Merge Sort
21+
// Merge sorted chunks with Merge Sort
2222
var size = k
2323
while (size < n) {
2424
for (left <- 0 until n by 2 * size) {
@@ -32,7 +32,7 @@ def timSort(arr: Array[Int], k: Int = 64): Unit = {
3232
}
3333

3434
// Helper function: Insertion Sort for a subarray
35-
private def insertionSortInPlace(arr: Array[Int], start: Int, end: Int): Unit = {
35+
private def subArrayInsertionSort(arr: Array[Int], start: Int, end: Int): Unit = {
3636
for (i <- start + 1 until end) {
3737
val key = arr(i)
3838
var j = i - 1

0 commit comments

Comments
 (0)