From 9a5bc0137aa4a9b763d1cb2860f068df7640cc41 Mon Sep 17 00:00:00 2001 From: vj586da Date: Wed, 1 Dec 2021 20:33:09 +0100 Subject: [PATCH] first commit --- a4/program.c | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 a4/program.c diff --git a/a4/program.c b/a4/program.c new file mode 100644 index 0000000..d83a70d --- /dev/null +++ b/a4/program.c @@ -0,0 +1,72 @@ +#include +#include +#include + +#define SIZE 20 + +int checkMinHeap(const long* arr, const int size){ + 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; + } + return 1; +} + +long int* strToInt(const char* chArr){ + int j = strlen(chArr); + //int i = 0; + //printf("dlength %d\n",j/2-1); + long int* dArr = (long int*)calloc(j,sizeof(long)); + char* pEND; + for(int i=0; i