Waiting for answer This question has not been answered yet. You can hire a professional tutor to get the answer.
typedef struct MyArray { int size; // # of occupied cells across all fragments int numbFrag; // # of fragments (arrays) in this
typedef struct MyArray
{
int size; // # of occupied cells across all fragments
int numbFrag; // # of fragments (arrays) in this struct
int fragLen; // # of cells per fragment
int numbActiveFrags; // # of allocated (non-NULL) fragments
int **frags; // array of pointers to individual fragments
int *fragSizes; // stores number of used cells in each fragment
} MyArray;
int set(MyArray *array, int index, int key)
{
}
Instructions: Insert key into the appropriate index of MyArray. Based on the index parameter passed to this function, as well as the number of fragments in the array and the length of each fragment, you need to determine which fragment index maps to, and exactly which cell in that array fragment is being sought.
If the fragment where we need to insert key is NULL, then you should dynamically allocate space for that fragment (an array of fragLen integers), initialize each cell in that new fragment to UNUSED (which I have a #defined in MyArray.h), update the struct's numActiveFrags member, and store key at the appropriate index in the new allocated array