Map & Prioritary queue

BlitzMax Forums/BlitzMax Programming/Map & Prioritary queue

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Hello Dremora.
The tree is used for for simple ordering the prioritys. In each node use a LinkedList. This is very eficient, the search for next priority is O(log(n) ) eficient and the extraction for linkedList is O(k) constant eficiency for use only the last and the first elements.
If you use a big number of elements the implementation look very eficient.
The method setPrioridad() not is O(log(n)) eficient. It search object in linked list.
I use the priority queue for painting the sprites in my prefered order. I not use desencolar. i use and enumerator and if ne sprite is moved to front i use setPrioridad() for repriorice it. This is very fast that sort entire queue.

Ahhh! brl.map is not balanced. not is one good implementation of red-black three. Test it! Use a set of preordered keys in brl.map. The eficiency is O(n). Very, very bad. Use the same set in TTreeMap. Get times and compare. 20000 elements need 200 millisec in Ttreemap and 40000 millisec in brl.map

The brl.map is only eficient with random ordered keys.

Bye,
paposo