From 9258ce3eac6f1f839b221e1a871050eff1013b5e Mon Sep 17 00:00:00 2001 From: vj586da Date: Thu, 2 Dec 2021 03:31:27 +0100 Subject: [PATCH] second commit --- a4/program.c | 38 +++++++++++++++++--------------------- 1 file changed, 17 insertions(+), 21 deletions(-) diff --git a/a4/program.c b/a4/program.c index d83a70d..20c47c1 100644 --- a/a4/program.c +++ b/a4/program.c @@ -5,6 +5,9 @@ #define SIZE 20 int checkMinHeap(const long* arr, const int size){ + if(size == 1){ + return 1; + } for (int i = 0; i<=(size-2)/2; i++) { if(arr[2*i] < arr[i]) return -1; if(arr[2*i+1] < arr[i]) return -1; @@ -15,40 +18,33 @@ int checkMinHeap(const long* arr, const int size){ long int* strToInt(const char* chArr){ int j = strlen(chArr); //int i = 0; + int counter=0; //printf("dlength %d\n",j/2-1); - long int* dArr = (long int*)calloc(j,sizeof(long)); + long int* tmp = (long int*)calloc(j,sizeof(long)); char* pEND; for(int i=0; i