0

I am searching for priority Queue (min heap or max heap) in C# , is there built in data structure in C# , what's that ? , how is it efficiency ?
tips : 1-efficient Working with memory
2-Fast in Insert and remove

mojtaba
  • 309
  • 1
  • 3
  • 16
  • i want discuss professionally ! not just priority queue ! – mojtaba May 11 '13 at 12:16
  • 1
    But this isn't a discussion board. That's the short way to getting closed. – Henk Holterman May 11 '13 at 12:17
  • implementing data structures that work such as i want not finishing work , PQ must be efficient and implement from fast structures , i have one implementation but it can't satisfay me , i request for yours experience to do that better , or use another best one , please Sharing New implementation and tips – mojtaba May 11 '13 at 12:20
  • http://codereview.stackexchange.com/questions/9773/optimizing-liststring-performance/9777#9777 – L.B May 11 '13 at 12:26
  • 1
    @ L.B : that isn't in C# or clear – mojtaba May 11 '13 at 12:37
  • @mojtaba It is c# and just one source file without referencing any external library. – L.B May 11 '13 at 12:40

2 Answers2

2

There's my Priority Queue in C#. Also, a lighter-weight version is at A Generic Binary Heap Class.

The second one is more memory-efficient than the first.

Neither is "fast in search." Searching a heap is not an efficient operation. Heaps are designed to quickly insert and quickly remove the first item.

Jim Mischel
  • 122,159
  • 16
  • 161
  • 305
0

I like using the OrderedBag and OrderedSet classes in PowerCollections as priority queues.

saeed
  • 2,342
  • 2
  • 18
  • 40