Re: arrays vs linked lists

From: George (
Date: 01/06/99

On Wed, 6 Jan 1999, Patrick Dughi wrote:

>        The only advantage in this situation is lookup time - arrays have
>a lookup time less than or equal to linked lists... Think about it this
>way, if you have all the mobs in the game, and you want to load up a mob
>with a rnum of 700, you would have to go through a linked list structure
>700 times before you reach your mob.  With an array, it would be

Any sane MUD implementation of them that offsets a bit of memory for speed
should store a mobs_in_next_zone pointer so that it can skip to the next
hundred batch.


Zone0 -> Zone1 -> Zone2 -> Zone6 -> Zone70
Mob0     Mob10    Mob20          -> Mob700

Still not as great as arrays but not awful either.

If you don't mind the speed and want to save 4 bytes per mob, then the
above would be skipped.  MUDs use more memory anyway...

George Greer

     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     |  |

This archive was generated by hypermail 2b30 : 12/15/00 PST