works properly
This commit is contained in:
@ -77,17 +77,18 @@ public class timsort {
|
||||
int[] temp = new int[notMerged[i].length + notMerged[i + 1].length];
|
||||
merged[i / 2] = temp;
|
||||
int[] j = new int[2];
|
||||
for(int l = 0; l < temp.length; ++l) {
|
||||
int w = notMerged[i][j[0]] > notMerged[i + 1][j[1]] ? 1 : 0;
|
||||
int w = 0;
|
||||
int l = 0;
|
||||
for(; j[w] < notMerged[i + w].length; ++l) {
|
||||
w = notMerged[i][j[0]] > notMerged[i + 1][j[1]] ? 1 : 0;
|
||||
System.out.println("w: " + w);
|
||||
temp[l] = notMerged[i + w][j[w]];
|
||||
++j[w];
|
||||
if(j[w] >= notMerged[i + w].length) {
|
||||
int b = w != 0 ? 0 : 1;
|
||||
for(int k = j[b]; k < notMerged[i + b].length; ++k, ++l) {
|
||||
temp[l] = notMerged[i + b][k];
|
||||
}
|
||||
}
|
||||
}
|
||||
int b = w != 0 ? 0 : 1;
|
||||
for(int k = j[b]; l < temp.length; ++k, ++l) {
|
||||
System.out.println("Index: " + k + " length: " + notMerged[i + b].length);
|
||||
temp[l] = notMerged[i + b][k];
|
||||
}
|
||||
}
|
||||
if(notEvenLen == 1) merged[merged.length - 1] = notMerged[notMerged.length - 1];
|
||||
|
||||
Reference in New Issue
Block a user