[FEATURE] Update "list" implementation #114

Open
opened 2026-01-29 15:03:55 +00:00 by claunia · 10 comments
Owner

Originally created by @ybrenning on GitHub (Aug 24, 2022).

Originally assigned to: @ybrenning on GitHub.

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

Originally created by @ybrenning on GitHub (Aug 24, 2022). Originally assigned to: @ybrenning on GitHub. ### 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](https://github.com/TheAlgorithms/C/blob/master/CONTRIBUTING.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_
claunia added the enhancementdont-close labels 2026-01-29 15:03:55 +00:00
Author
Owner

@github-actions[bot] commented on GitHub (Sep 24, 2022):

This issue has been automatically marked as abandoned because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@github-actions[bot] commented on GitHub (Sep 24, 2022): This issue has been automatically marked as abandoned because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Author
Owner

@Panquesito7 commented on GitHub (Sep 25, 2022):

Thanks for your interest in contributing! 🚀
Would you like to work on all of that? 😃

Let us know if you need any help. Thank you.

@Panquesito7 commented on GitHub (Sep 25, 2022): Thanks for your interest in contributing! 🚀 Would you like to work on all of that? 😃 Let us know if you need any help. Thank you.
Author
Owner

@ybrenning commented on GitHub (Sep 25, 2022):

Sure, I would like to work on that :)

@ybrenning commented on GitHub (Sep 25, 2022): Sure, I would like to work on that :)
Author
Owner

@JKP0495 commented on GitHub (Oct 6, 2022):

please assign this to me, i will do it in 2 days

@JKP0495 commented on GitHub (Oct 6, 2022): please assign this to me, i will do it in 2 days
Author
Owner

@Panquesito7 commented on GitHub (Oct 29, 2022):

@ybrenning, are you still willing to work on this? Thanks.

@Panquesito7 commented on GitHub (Oct 29, 2022): @ybrenning, are you still willing to work on this? Thanks.
Author
Owner

@niranjank2022 commented on GitHub (Sep 12, 2023):

@Panquesito7 @ybrenning Can I work on this issue? And, I would also like to hear what other methods needs to be included apart from the ones below?

append(int val)
insert(int val, int index)
pop()
remove(int index)
length()
printArray()
sort()
reverse()
index(int value)
get(int index)

@niranjank2022 commented on GitHub (Sep 12, 2023): @Panquesito7 @ybrenning Can I work on this issue? And, I would also like to hear what other methods needs to be included apart from the ones below? append(int val) insert(int val, int index) pop() remove(int index) length() printArray() sort() reverse() index(int value) get(int index)
Author
Owner

@nikhilrajbhar17 commented on GitHub (Aug 13, 2024):

I can fix this,can you assign this to me?

@nikhilrajbhar17 commented on GitHub (Aug 13, 2024): I can fix this,can you assign this to me?
Author
Owner

@Sofiyan-coder commented on GitHub (Sep 23, 2024):

@ybrenning can you assign me this task? I want to support and contribute to this project now and in the future. It would be an honor to be part of this amazing open-source project.

@Sofiyan-coder commented on GitHub (Sep 23, 2024): @ybrenning can you assign me this task? I want to support and contribute to this project now and in the future. It would be an honor to be part of this amazing open-source project.
Author
Owner

@y-syntax commented on GitHub (Apr 9, 2025):

Hey there! I’m new to open source, but really excited to dive in. This issue caught my eye—I'd love to help out if it's still up for grabs. Any pointers or resources to help me get started would mean a lot!

@y-syntax commented on GitHub (Apr 9, 2025): Hey there! I’m new to open source, but really excited to dive in. This issue caught my eye—I'd love to help out if it's still up for grabs. Any pointers or resources to help me get started would mean a lot!
Author
Owner

@Vadank-Ji commented on GitHub (Oct 21, 2025):

I feel this issue has been on for quite long so I would like to work on this and will be able to do it quickly.

@Vadank-Ji commented on GitHub (Oct 21, 2025): ### I feel this issue has been on for quite long so I would like to work on this and will be able to do it **quickly**.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/C#114