diff options
author | Santo Cariotti <dcariotti24@gmail.com> | 2020-03-26 21:45:48 +0100 |
---|---|---|
committer | Santo Cariotti <dcariotti24@gmail.com> | 2020-03-26 21:45:48 +0100 |
commit | bd39a249f8ac8abfc1f1a128479d3438f0cc1594 (patch) | |
tree | 3d17860c2363006273a30ea39dd1ea0cfd757f01 | |
parent | 37c324a2c1bb0a1d98834e7b3690ed2fc13f3fbf (diff) |
mergesort: fix size of temp array
-rw-r--r-- | I_anno/Programmazione_2/mergesort.cc | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/I_anno/Programmazione_2/mergesort.cc b/I_anno/Programmazione_2/mergesort.cc index 6df83e5..21dc8af 100644 --- a/I_anno/Programmazione_2/mergesort.cc +++ b/I_anno/Programmazione_2/mergesort.cc @@ -3,11 +3,10 @@ using namespace std; void merge(int A[], int l, int q, int r) { - int size = (sizeof(*A)*2)+1; int i = l; int j = q+1; int k = l; - int B[size]; + int B[r]; while((i <= q) && (j <= r)) { if(A[i] <= A[j]) |