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
Asked
Active
Viewed 1.4k times
0
![](../../users/profiles/2301545.webp)
mojtaba
- 309
- 1
- 3
- 16
-
i want discuss professionally ! not just priority queue ! – mojtaba May 11 '13 at 12:16
-
1But 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 Answers
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.
![](../../users/profiles/56778.webp)
Jim Mischel
- 122,159
- 16
- 161
- 305
-
-
-
@Pangamma Thanks for letting me know. http://www.mischel.com/pubs/priqueue.zip will get you started. – Jim Mischel Jun 04 '20 at 03:57
0
I like using the OrderedBag and OrderedSet classes in PowerCollections as priority queues.
![](../../users/profiles/1606402.webp)
saeed
- 2,342
- 2
- 18
- 40