From bd39a249f8ac8abfc1f1a128479d3438f0cc1594 Mon Sep 17 00:00:00 2001 From: Santo Cariotti Date: Thu, 26 Mar 2020 21:45:48 +0100 Subject: mergesort: fix size of temp array --- I_anno/Programmazione_2/mergesort.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'I_anno') 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]) -- cgit v1.2.3-18-g5258