I can say with some certainty that you're not going to find an algorithm bound 
by O(1) that will find rooms in an array smaller than the entire range of 
vnums.  The best you're going to do with compressing the array is some sort 
of hashing/radix sort like stock get_room_index uses.

On Thursday 14 August 2003 01:48 pm, Jason Gauthier wrote:
> Hey Gang-
>
> Sometime back I removed all my get_room_index (and others) with an array.
> (pRoomArray).
>
> However, I have *very* high vnums.  So, I've defined a MAX_ROOM at 1500000.
> His makes for a large array!
>
> I use pRoomArray[vnum] to quickly and efficiently access room data.
>
> I would like to use this convention while allocating the memory in the
> array dynamically (so I only allocate 300k rooms worth, not 1.5m)
>
> Is there someway I can keep my method but gain a better allocation concept?
>
> I don't want to loop through pointers, or vnums, or anything to find a
> room. I want to call it out quickly and easily.
>
> All ideas welcome, and I hope I've explained what I'm doing here.
>
> Thanks!
>
> Jason


Reply via email to