From 7e78ae68ba9777707ae5c161a2cb285bfe0d8bd3 Mon Sep 17 00:00:00 2001 From: Lawrence Chung <chungl1@mcmaster.ca> Date: Mon, 26 Feb 2018 03:17:35 -0500 Subject: [PATCH] Questions about conditional and incorrect statements --- src/sort/mergeSort.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/sort/mergeSort.java b/src/sort/mergeSort.java index 24f752a..04c3573 100644 --- a/src/sort/mergeSort.java +++ b/src/sort/mergeSort.java @@ -19,12 +19,14 @@ public class mergeSort implements GeneralCompare{ } for(int i = 1; i <= n; i++){ - if(i > mid) - gc[i] = aux[mid+2]; - else if(mid+1 > n) + if(i > mid) //Should these not be a[i] and a[mid]? + gc[i] = aux[mid++]; + else if(mid+1 > n) //^ gc[i] = aux[2]; - else if(compare(aux[mid+1],aux[1]) < 0) + else if(compare(aux[mid+1],aux[1]) < 0)// ? gc[i] = aux[i]; //fill statement (incorrect) + else + gc[i] = aux[2]; } } -- GitLab