Re: [CODE] Priority Queues :: HowTo?

From: George Greer (greerga@circlemud.org)
Date: 02/11/02


On Mon, 11 Feb 2002, Justin Adler wrote:

>   I'm trying to impliment a list of rooms. The list is a fixed size
>(lets say 1000 rooms max). The list needs to be prioritised, becuase i
>would like the most 'important / common' rooms being near the head (ie.
>Highest priority), while the least most common rooms down the end of the
>list.

I suppose the question is, "why do you want common rooms at the head?" Is
the current behavior of at-worst 11 searches (10.8765 for 1,880 rooms)
across the world array too slow for some reason?  Is a hash table not
feasible?  Why not just pass around 'room_data *' instead of all virtual
numbers?

It all depends on why you're trying to do what you're trying to do.  You
gave us an algorithm for the solution to a problem we don't know.

--
George Greer
greerga@circlemud.org

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   | Newbie List:  http://groups.yahoo.com/group/circle-newbies/   |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 06/25/03 PDT