Skip to content

Commit a87fba6

Browse files
Merge pull request #76 from aphitorite/621
std::stable_sort fix
2 parents 7e91488 + 91f0b09 commit a87fba6

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/sorts/BottomUpMergeSort.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,10 +120,12 @@ private void stableSort (int[] a, int n) {
120120
// Sort a[0:n-1] using merge sort.
121121
int s = 16; // segment size
122122
int[] b = new int [n];
123+
int i;
123124

124-
for(int i = 0; i <= n - 16; i += 16) {
125+
for(i = 0; i <= n - 16; i += 16) {
125126
binaryInserter.customBinaryInsert(a, i, i + 16, 0.35);
126127
}
128+
binaryInserter.customBinaryInsert(a, i, n, 0.35);
127129

128130
while (s < n)
129131
{

0 commit comments

Comments
 (0)