linked list

Joel Christensen joelcnz at gmail.com
Sun Sep 26 09:38:25 PDT 2010


> I am looking for use cases of singly|doubly linked lists, I (nearly) never need them in my code. Few questions:
> 1) What's a typical (or average) length of your list?

Thanks for your interest bearophile.

I haven't used linked list much more than just trying them out. And my 
game is at its earlier stages.

Not very much, 2 players, mines ad lazer bolts are added and removed 
when used. I guess around 10.

> 2) Are items sorted (like from the bigger to the smaller one)?

I've got the player objects fixed at the head of the array.

> 3) Is the item order important (so is it OK to shuffle them in some other ways)?

I'm thinking of having then sorted as objects are added. I'm also 
thinking of having a pointer to the start and end of each kind of object 
(like sub lists).

> 4a) How often/many do you need to add items to the list?

My game is only small at the moment, so not a good sample. I guess every 
time a player fires a lazer bolt or lays a mine, but those objects don't 
last long.

> 4b) How often/many do you need to remove items to the list?

About as often as I add them, eg. the mines and lazers are added and 
taken away often. How many, two at a about the same time with two players.


More information about the Digitalmars-d-learn mailing list