Description
Detailed description
I would like to overhaul the implementation in list.c
as it currently seems to be implementing some kind of abstract version of a stack data structure. I would propose to change this to a kind of dynamic array, similar to how the list
data type is used in Python or the ArrayList
in Java.
I would also like to add some improved documentation in accordance with CONTRIUBUTING.md as well as basic testing to demonstrate the functionality of the list.
The current implementation only allows for pushing to the front of the "list" (no pop operator or possibility for deletion of elements) and has no way of displaying the contents of the list without converting it to an array first and then using a seperately implemented print function which seems unnecessarily convoluted.
Context
I think that this implementation would be a lot more fitting for the list
data structure and would be more easy to understand as well as more flexible to use. It would allow for basic operations such as insertion, deletion and printing which aren't entirely possible yet. The improved documentation and simple tests would of course also help in making the code easier to understand.
Possible implementation
Use a struct which keeps track of the current size/length of the list, the current capacity which would allow for resizing and keeps track of the current maximum amount of elements and a pointer to the beginning of the actual elements of the list.
Additional information
No response