Advertisement

Linked Lists

Started by January 03, 2003 05:17 PM
2 comments, last by Tazel 21 years, 10 months ago
Are linked lists basically loops that hold data and increase as needs be? tcache Contact Me ----------- Games don''t affect kids. If Pac-man had affected us, we''d all be sitting in darkened rooms munching pills and listening to repetitive electronic music. -- Kristian Wilson(Nintendo Inc., 1989)
tcacheContact Me-----------AH! MY BRAIN IS GOING TO SELF-DETONATE! -- Yours Truly (Jan, 2003)
it''s not exactly a loop. it''s more like a list of pointers. it''s basically a dynamic array. check out vector.h for a basic implimentation. there is also a tutorial on nehe.gamedev.net about them in greater depth.

My Homepage
Freeservers.com sucks. Angelfire.lycos.com is cool.
My HomepageSome shoot to kill, others shoot to mame. I say clear the chamber and let the lord decide. - Reno 911
Advertisement
somebody posted this link on these forums which i found to be very usefull

http://www.afrohorse.com/techdocs/linkedlists.htm
quote: Original post by Julio
it''s not exactly a loop. it''s more like a list of pointers. it''s basically a dynamic array. check out vector.h for a basic implimentation. there is also a tutorial on nehe.gamedev.net about them in greater depth.


I hope you dont mean std::vector is a linked list because it is not!

Tazel, this may help you to visualize a linked list:

Ever played with Barrel of Monkeys? Imagine each monkey as being one link in the list. It holds its own piece of data. You can hook another monkey on to the end of the list when you need to add another piece of data.

This information store grows as you need it to and it is also very easy to remove a single data item. However, you do not have the random access ability as you do with vectors (ie, you cant say list[5] and the only processing done is to return the fifth element). To reach a link in the list you must traverse to that link which makes the list a better information store for when you need to access elements sequentially (ie, begin with the first and work your way to the end) rather than randomly (ie, access 1, and then maybe 8, and then maybe 3, etc). Because each element in a linked list is simply linked to the others by its two neighbors, it is a much simpler operation to remove elements from a linked list than from a vector - you just need to change where a few pointers are pointing.


The hackers must have gotten into the system through the hyperlink!!
Invader''s Realm

This topic is closed to new replies.

Advertisement