Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

frizb

Things to avoid?

This topic is 6909 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Guest Anonymous Poster
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.

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
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

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!