I need to make a "channel list." Users need to be added when they join, and removed when they leave. The number of elements should be, on average, 50. Linked list or dynamic array?
This is a discussion on List within the C Programming forums, part of the General Programming Boards category; I need to make a "channel list." Users need to be added when they join, and removed when they leave. ...
I need to make a "channel list." Users need to be added when they join, and removed when they leave. The number of elements should be, on average, 50. Linked list or dynamic array?
From a C perspective, I would think the only difference would be that the array would be contiguous in storage and the linked list entries could be anywhere.
Do you have a need to traipse through the data super super quickly? If so, a dyn array and pointer arithmetic might be faster than scooting through a linked list. (either way, it's minimal overhead)
My 2 cents.
Last edited by Dino; 10-17-2008 at 12:51 PM.
Mac and Windows cross platform programmer. Ruby lover.
Quote of the Day
12/20: Mario F.:I never was, am not, and never will be, one to shut up in the face of something I think is fundamentally wrong.
Amen brother!
I think the flip side of that is going to be removing people from the middle of the structure: easy in a list, hard in an array (unless you make it a sentinel value and reuse it later).