Jump to content

  • Log In with Google      Sign In   
  • Create Account

Things to avoid?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 frizb   Members   -  Reputation: 122

Like
Likes
Like

Posted 25 October 1999 - 12:06 AM


In one of the game programming books I have been reading, they mention that you should avoid using linked lists. Is this info wrong or no longer applicable like using floats, or should I avoid them? If so, what are my alternatives?

Sponsor:

#2 Anonymous Poster_Anonymous Poster_*   Guests   -  Reputation:

Likes

Posted 22 October 1999 - 05:55 PM

There is no concrete answer to that becos it all depends on the particular problem you are dealing with. If you're dealing with data that needs to be sorted/inserted/deleted on the fly, then linked list would be the way to go. But for simple lists of items, go with simple arrays.

#3 Anonymous Poster_Anonymous Poster_*   Guests   -  Reputation:

Likes

Posted 22 October 1999 - 06:59 PM

You want to look at what your situation is

If you are going to be iterating through the entire list in one go, and order is unimportant, then a linked list can be much faster, however, if you are accessing the data in no particular order, the it might be faster to use an array.

------------------
LoungePig
OpenGUI


#4 MikeD   Members   -  Reputation: 158

Like
Likes
Like

Posted 25 October 1999 - 12:06 AM

It also depends on the size of the data to be placed in the array/LL.
Remember there is an overhead of at least one pointer (if not two) of 4 bytes and the time it takes to malloc memory every time a new element is added.
Basically they are slower to create, more prone to memory leaks due to bad programming and more of a hassle to maintain.
But if you don't know the size of the data to be stored then linked lists are the way to go.
I use them all the time, you just have to get used to them and create some library's.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS