Thread: List

  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
    Chappell Hill, Texas
    Posts
    2,332
    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.
    Mainframe assembler programmer by trade. C coder when I can.

  3. #3
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    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, 05: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, 10:21 PM