Question: Array List Create set of functions for managing an array list using C program Your array list program must include the following functions: Requirement Conditions
Array List
Create set of functions for managing an array list using C program

Your array list program must include the following functions: Requirement Conditions Function ArrayList* alist initialize(int, int, char*) Input Parameters An integer for setting the starting maximum size, an integer for setting the data type size, and a string representing the name of the data type being stored. Return Value An initialized array list. Notes An initialized array list will be allocated enough space up to the maximum size, have the data type and item size set appropriately, and will have its current size set to 0. The maximum size should also be stored. Requirement Conditions Function bool alist add(ArrayList", void") Input Parameters A pointer to an array list and a void pointer to an element Return Value True if the element was successfully added to the array list. Otherwise false. Notes This function should insert the given element on the end of the array list. Requirement Conditions Function bool alist add at(ArrayList*, int, void*) Input Parameters A pointer to an array list, an int representing an index, and a void pointer to an element. Return Value True if the element was successfully added to the array list. Otherwise false. Notes This function should insert the given element at the index location in the array list. Requirement Conditions Function void alist clear(ArrayList*) Input Parameters A pointer to an array list. Return Value None. Notes This function should deallocate all array list elements and set the current size to 0. Requirement Conditions Function void* alist get(ArrayList*, int) Input Parameters A pointer to an array list and an int representing an index. Return Value A void pointer to the element stored in the given index of the array list. If the given index is not in the list range, return NULL. Notes This function should return the void pointer stored in the given index of the array. Requirement Conditions Function int alist index of ArrayList*, void*) Input Parameters A pointer to an array list and a void pointer to an element Return Value The index containing the element. -1 if the element is not in the list. Notes This function should search the array list for the element and return its index if found. Requirement Conditions Function void alist remove(ArrayList", int) Input Parameters A pointer to an array list and an int representing an index. Return Value A pointer to the element removed from the list. Otherwise NULL. Notes This function should remove the element from the list and return it. Requirement Conditions Function bool alist destroy(ArrayList*) Input Parameters A pointer to an array list. Return Value True if the array list is successfully deallocated. Otherwise false. Notes This function should deallocate all of the data, the type name, and finally the array list Requirement Conditions Function bool alist resize(ArrayList*) Input Parameters A pointer to an array list. Return value True if the array list has been successfully resized. Otherwise false. Notes This function should attempt to grow the array list by a growth factor of 2. Your array list program must include the following functions: Requirement Conditions Function ArrayList* alist initialize(int, int, char*) Input Parameters An integer for setting the starting maximum size, an integer for setting the data type size, and a string representing the name of the data type being stored. Return Value An initialized array list. Notes An initialized array list will be allocated enough space up to the maximum size, have the data type and item size set appropriately, and will have its current size set to 0. The maximum size should also be stored. Requirement Conditions Function bool alist add(ArrayList", void") Input Parameters A pointer to an array list and a void pointer to an element Return Value True if the element was successfully added to the array list. Otherwise false. Notes This function should insert the given element on the end of the array list. Requirement Conditions Function bool alist add at(ArrayList*, int, void*) Input Parameters A pointer to an array list, an int representing an index, and a void pointer to an element. Return Value True if the element was successfully added to the array list. Otherwise false. Notes This function should insert the given element at the index location in the array list. Requirement Conditions Function void alist clear(ArrayList*) Input Parameters A pointer to an array list. Return Value None. Notes This function should deallocate all array list elements and set the current size to 0. Requirement Conditions Function void* alist get(ArrayList*, int) Input Parameters A pointer to an array list and an int representing an index. Return Value A void pointer to the element stored in the given index of the array list. If the given index is not in the list range, return NULL. Notes This function should return the void pointer stored in the given index of the array. Requirement Conditions Function int alist index of ArrayList*, void*) Input Parameters A pointer to an array list and a void pointer to an element Return Value The index containing the element. -1 if the element is not in the list. Notes This function should search the array list for the element and return its index if found. Requirement Conditions Function void alist remove(ArrayList", int) Input Parameters A pointer to an array list and an int representing an index. Return Value A pointer to the element removed from the list. Otherwise NULL. Notes This function should remove the element from the list and return it. Requirement Conditions Function bool alist destroy(ArrayList*) Input Parameters A pointer to an array list. Return Value True if the array list is successfully deallocated. Otherwise false. Notes This function should deallocate all of the data, the type name, and finally the array list Requirement Conditions Function bool alist resize(ArrayList*) Input Parameters A pointer to an array list. Return value True if the array list has been successfully resized. Otherwise false. Notes This function should attempt to grow the array list by a growth factor of 2
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
