Sunday, October 16, 2011

C#–PriorityQueue Sample

I was reading up on Priority Queues and its been a while since I last implemented one. So I thought I would implement it in C#.

Not perfect code, but, it shows you how to implement a priority queue using a binary heap. Also, its implemented using generics, so it will support any kind of object you want to throw at it (as long as you implement IComparable). In addition, you can set the type of the PriorityQueue to be MinHeap or MaxHeap based.

No comments: