Linked List Architecture
I''m making a generic linked list class that can be used in anything, from gaming to database programming. Should I make it doubly or singly linked. Also, which method would be faster:
Store each node as a void pointer to memory, and keep track of the element size so i know how many bytes to extract from the address to retrieve the node
OR
Store each node as a separate NODE class structure, and use pointers to node classes as opposed to actual memory.
I am after speed above all else. Thanx.
What do you need it for exactly? Only then can you determine what kind of list you want.
Do you care about the size of mem used? (single costs less)
Do you want a fast search algo for the list? (maybe trees are better then)
Have you thought about doing this OO? (Derive a data class from the node class...using a virtual sort function...)
Do you care about the size of mem used? (single costs less)
Do you want a fast search algo for the list? (maybe trees are better then)
Have you thought about doing this OO? (Derive a data class from the node class...using a virtual sort function...)
If speed is what you are after and you know by what values you are going to sort against I would recommend using a Binary Search Tree. If that is not the case then speed won''t come to you very easily. Linked lists are better used when you want the kind of dynamic memory allocation that they can provide. I consider them essential to programming and worth the expense. If you do not feel this way I reommend using dyamically allocated arrays or domthing similar. i hope this helps.
Creativity -- Concept -- CodeYour game is nothing if you don't have all three.http://www.wam.umd.edu/~dlg/terc.htm
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement