List

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. ...

  1. #1
    Registered User
    Join Date
    Aug 2008
    Posts
    67

    List

    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?

  2. #2
    Jack of many languages Dino's Avatar
    Join Date
    Nov 2007
    Location
    Katy, Texas
    Posts
    2,309
    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 01: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!

  3. #3
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,185
    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).

  4. #4
    Registered User
    Join Date
    Aug 2008
    Posts
    67
    Quote Originally Posted by tabstop View Post
    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).
    Ended up using a linked list for this reason.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Link List math
    By t014y in forum C Programming
    Replies: 17
    Last Post: 02-20-2009, 06:55 PM
  2. instantiated from here: errors...
    By advocation in forum C++ Programming
    Replies: 5
    Last Post: 03-27-2005, 09:01 AM
  3. How can I traverse a huffman tree
    By carrja99 in forum C++ Programming
    Replies: 3
    Last Post: 04-28-2003, 06:46 PM
  4. List class
    By SilasP in forum C++ Programming
    Replies: 0
    Last Post: 02-10-2002, 05:20 PM
  5. singly linked list
    By clarinetster in forum C Programming
    Replies: 2
    Last Post: 08-26-2001, 11:21 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21