Priority queue in .Net [closed]

You might like IntervalHeap from the C5 Generic Collection Library. To quote the user guide Class IntervalHeap<T> implements interface IPriorityQueue<T> using an interval heap stored as an array of pairs. The FindMin and FindMax operations, and the indexer’s get-accessor, take time O(1). The DeleteMin, DeleteMax, Add and Update operations, and the indexer’s set-accessor, take time … Read more

The built-in iterator for java’s PriorityQueue does not traverse the data structure in any particular order. Why?

Because the underlying data structure doesn’t support it. A binary heap is only partially ordered, with the smallest element at the root. When you remove that, the heap is reordered so that the next smallest element is at the root. There is no efficient ordered traversal algorithm so none is provided in Java.