Build a resizeable array of integers that can grow on dem…

Build a resizeable array of integers that can grow on demand and compile and make it available as a library. Make sure you use the .h and .c file structure , and make use of #ifndef and similar preprocessor directives to make sure your .h files can be included multiple times without problems. Make use of the following struct. typedef struct { int *array; size_t used; size_t size; } Array; Use this struct to store a resizeable array of integers. In “used,” store the index up to which entries of array are being used. In “size,” keep the size of “array”. Implement the following functions using proper dynamic memory allocation functions. Double the size of “array” when more room is needed. Decrease the size of the array to half when the array is less than half full. The array size should be changed automatically as part of the insert void insertIntoArray(Array *a, int element) void removeLast(Array *a) // removes last element if size > 0, does nothing otherwise void freeArray(Array *a) void initArray(Array *a, size_t initialSize) For the initArray() function, assume that the user first allocates an Array struct and then calls insertArray as follows: struct Array myArray; initArray(&myArray, 10); 2- Suppose that you are asked to build a data structure that holds a set of strings. Modify the data structure you built in Problem 1 to store char *’s in the resizeable array instead of integers. Provide functions for making a set empty, inserting and removing an element into the set, and checking whether an element is in the set. Make sure that your set does not include duplicate copies of the same string (char * with the same contents, use strcmp to compare strings). Define a struct MySet so that sets can be manipulated as in the following example. MySet *s; . . . initSet(s); insert(s, “Hello”); insert(s, “world”); insert(s, “Hello”); del(s, “world”); isInSet(s, “Hello”); // returns 1 if in set, otherwise 0 emptySet(s); // empties s by removing all the strings in it … 3- Redo problem 2, but this time implement a set of pointers to Account struct’s. typedef struct{ int acccountNo; char *nameOfHolder; double accountBalance; } Account; The set should make sure that there are no two Account struct’s with the same account number in the set. Assume there are two accounts A1 and A2 with different account numbers. The following manipulation should work. MySet *sAcc; . . . initSet(sAcc); insert(sAcc, &A1); insert(sAcc, &A2); insert(sAcc,&A1); del(sAcc, &A2); isInSet(sAcc, &A1); // returns 1 if in set, otherwise 0 emptySet(sAcc); // empties s by removing all accounts in it … 4- Write two functions, readArrayFromFile(Array *a, char *filename); writeArrayToFile(Array *a, char *filename); that store the contents of an Array struct in Problem 1 into a file and load the contents of the file into the Array. For readArrayFromFile, assume that the Array *a argument has 0 elements. Assume that the array with contents, 1, 2, 1, 3, 1 in an array of size 7 is represented with a file as follows: Array size 7 Number of array elements 5 Elements 1 2 1 3 1

#write essay #research paper #blog writing #article writing #academic writer #reflective paper #essay pro #types of essays #write my essay #reflective essay #paper writer #essay writing service #essay writer free #essay helper #write my paper #assignment writer #write my essay for me #write an essay for me #uk essay #thesis writer #dissertation writing services #writing a research paper #academic essay #dissertation help #easy essay #do my essay #paper writing service #buy essay #essay writing help #essay service #dissertation writing #online essay writer #write my paper for me #types of essay writing #essay writing website #write my essay for free #reflective report #type my essay #thesis writing services #write paper for me #research paper writing service #essay paper #professional essay writers #write my essay online #essay help online #write my research paper #dissertation writing help #websites that write papers for you for free #write my essay for me cheap #pay someone to write my paper #pay someone to write my research paper #Essaywriting #Academicwriting #Assignmenthelp #Nursingassignment #Nursinghomework #Psychologyassignment #Physicsassignment #Philosophyassignment #Religionassignment #History #Writing #writingtips #Students #universityassignment #onlinewriting #savvyessaywriters #onlineprowriters #assignmentcollection #excelsiorwriters #writinghub #study #exclusivewritings #myassignmentgeek #expertwriters #art #transcription #grammer #college #highschool #StudentsHelpingStudents #studentshirt #StudentShoe #StudentShoes #studentshoponline #studentshopping #studentshouse #StudentShoutout #studentshowcase2017 #StudentsHub #studentsieuczy #StudentsIn #studentsinberlin #studentsinbusiness #StudentsInDubai #studentsininternational