D
Dan H.
Hello,
I have implemented a C# priority queue using an ArrayList. The objects
being inserted into the priority queue are being sorted by 2 fields, Time
(ulong) and Priority (0-100).
When I enqueue, I do a binary search on where to put the object and then
insert using that index and arraylist.insert(index, obj)
The bottom of my arraylist is always my lowest, therefore, dequeueing is
very fast and effecient.
Removing is done using a binary search as well and calling the
arraylist.remove.
I need to optimize my priorityqueue implementatation further. Here are a
couple of questions I have:
1. Would it be faster to just use C# array instead of ArrayList?
2. Anyone else have some C# priority queue approaches they would be willing
to share/discuss?
Thanks in advanced,
Dan
I have implemented a C# priority queue using an ArrayList. The objects
being inserted into the priority queue are being sorted by 2 fields, Time
(ulong) and Priority (0-100).
When I enqueue, I do a binary search on where to put the object and then
insert using that index and arraylist.insert(index, obj)
The bottom of my arraylist is always my lowest, therefore, dequeueing is
very fast and effecient.
Removing is done using a binary search as well and calling the
arraylist.remove.
I need to optimize my priorityqueue implementatation further. Here are a
couple of questions I have:
1. Would it be faster to just use C# array instead of ArrayList?
2. Anyone else have some C# priority queue approaches they would be willing
to share/discuss?
Thanks in advanced,
Dan