C # collection that behaves like C ++ set or priority_queue?

I've written Dijkstra's algorithm many times in C ++ - I need to set set or priotity_queue, both give me the ability to add an item and find the smallest one (using the comparator specified). Now I have a problem while trying to write Dijkstra in C # - is there some kind of framework that might be helpful to me? I need to add and find or erase the smallest element.

Using Visual Studio '08

+2


a source to share


2 answers


You can use SortedSet

it if you are using a newer version of the .NET Framework.



+2


a source


You can use mine. It's very simple; There is nothing interesting here.

http://blogs.msdn.com/ericlippert/archive/2007/10/08/path-finding-using-a-in-c-3-0-part-three.aspx



I wrote this for a simple implementation of the A * algorithm, which is a more efficient form of Dijkstra's algorithm.

+1


a source







All Articles