I know you guys hate them but heres another linked list question...

This is a discussion on I know you guys hate them but heres another linked list question... within the C++ Programming forums, part of the General Programming Boards category; Lol, well there seems to be a boom in questions of this nature but mine is simple. Ok, i know ...

  1. #1
    Registered User
    Join Date
    Nov 2004
    Location
    Pennsylvania
    Posts
    434

    I know you guys hate them but heres another linked list question...

    Lol, well there seems to be a boom in questions of this nature but mine is simple. Ok, i know what a linked list is, you can have single linked, double linked and trees. My question is what information is best stored in a linked list. I know i need to implement a minimax algorithm/tree into my code and i was told that a linked list was the best way to do it. What other information is best stored in a linked list? Thanks alot guys!

  2. #2
    Registered User
    Join Date
    Apr 2003
    Posts
    2,662
    My question is what information is best stored in a linked list.
    I don't think it has anything to do with the type of information you are storing. It has to do with how you plan on manipulating the information in the data structure, and what is the most efficient structure to use based on your requirements. For instance, are you going to be deleting or inserting elements in the middle of the data structure(list)? Or, do you only need to add or remove elements at the end of the data structure(vector)? Or, do you need to add and remove elements to both the beginning and end of the data structure(deque)?

  3. #3
    Registered User
    Join Date
    Nov 2004
    Location
    Pennsylvania
    Posts
    434
    ok, well then that too. I suppose it still falls under my scope of my question though. Ill just tack on: If you need to manipulate it alot too.

  4. #4
    aoeuhtns
    Join Date
    Jul 2005
    Posts
    581
    That stipulation means nothing. How would the data be manipulated.

  5. #5
    Registered User
    Join Date
    Nov 2004
    Location
    Pennsylvania
    Posts
    434
    Ok everyone i think you know what i mean. I understand how data is manipulated through linked lists. I have a general idea of what linked lists are. How about i change my question to this to get it all through your heads: What type data is most commonly represented in linked lists? Lets not discuss stipulations and technicalities, i just stated what i am asking, if someone could be so kind as to answer me i would greatly appreciate it. THanks!

  6. #6
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,893
    Large things. That's all the answer you're going to get from me. "get it all through your heads" indeed. You've been told your question is meaningless, yet you insist on asking it?
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  7. #7
    Rabble Rouser Slacker's Avatar
    Join Date
    Dec 2005
    Posts
    116
    >What type data is most commonly represented in linked lists?
    Just about anything. If you need a linear sequence of data, with the added benefit of quick insertion and deletion within it, and random access isn't necessary, a linked list is warranted. The data itself is usually irrelevant at this point because you're looking at how to store it, not what it is. What type of data is most common? It depends on what you're doing. I could be writing a report filter that uses a linked list of records where a record represents a line, or a collection of lines tokenized into more appropriate types. I could be writing a cat clone that stores a variable number of file streams in a linked list. Or I could simply be processing single characters and a linked list is more convenient than an array and I can afford the extra storage. How about general ledger totals? Queued ships for entry to and exit from a harbor? Student grades? Stacked GUI windows? Running process? Blocks of raw memory for a dynamic memory manager? As long as the operations on your collection of data fit the design of a linked list best, you can, and usually will, use a linked list regardless of the type of the data.

    Cheers!

  8. #8
    Registered User
    Join Date
    Nov 2004
    Location
    Pennsylvania
    Posts
    434
    Thanks so much Slacker, i really appreciate that. That was a very good explaination and it gave me the answer to my question. Thanks again!

    To cornedbee let me just say this: Your answer here was meaningless yet you insist on answering...
    Last edited by Junior89; 01-01-2006 at 04:09 PM.

  9. #9
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,893
    Oh, my answer had meaning. Just not what you wanted.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  10. #10
    Registered User
    Join Date
    Feb 2003
    Posts
    595
    Here's a thought: if you are implementing a minimax tree, why not organize your data in a tree structure?

  11. #11
    Registered User
    Join Date
    Nov 2004
    Location
    Pennsylvania
    Posts
    434
    Yes i know that, Minimax Tree <- Thats a bit of a hint lol

    But trees are usually implemented in linked lists correct?

  12. #12
    Super Moderator
    Join Date
    Sep 2001
    Posts
    4,913
    Think of a tree as a linked list with multiple "next" nodes. I only recommended linked lists as one of the data sturctures you learn about so you could learn the concepts of traversing through different systems.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. linked list question
    By mikeman in forum C Programming
    Replies: 1
    Last Post: 11-30-2008, 12:56 PM
  2. Linked List
    By jpipitone in forum C Programming
    Replies: 4
    Last Post: 03-30-2003, 08:27 PM
  3. problem with structures and linked list
    By Gkitty in forum C Programming
    Replies: 6
    Last Post: 12-12-2002, 05:40 PM
  4. How to use Linked List?
    By MKashlev in forum C++ Programming
    Replies: 4
    Last Post: 08-06-2002, 07:11 AM

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