We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f9b788f commit 550adb2Copy full SHA for 550adb2
src/main/java/com/thealgorithms/sorts/TimSort.java
@@ -71,10 +71,10 @@ public TimSort() {
71
* sorting.
72
*/
73
public void insertion_sort(int[] array, int start_idx, int end_idx) {
74
- for (int i = 0; i < array.length; i++) {
+ for (int i = start_idx; i <= end_idx; i++) {
75
int current_element = array[i];
76
int j = i - 1;
77
- while (j >= 0 && array[j] > current_element) {
+ while (j >= start_idx && array[j] > current_element) {
78
array[j + 1] = array[j];
79
j--;
80
}
0 commit comments