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.6k times
        
    3
            
            
         
    
    
        mojtaba
        
- 339
- 1
- 4
- 17
- 
                    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. – H H 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.
 
    
    
        Jim Mischel
        
- 131,090
- 20
- 188
- 351
- 
                    
- 
                    
- 
                    @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
- 
                    Alternative for [Priority Queue in C# (MSDN)](https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.priorityqueue-2) – Henrik Ginnerup Apr 21 '22 at 08:42
- 
                    1[WayBackMachine for **Priority Queue in C#**](https://web.archive.org/web/20101227044014/http://blog.mischel.com/2007/06/22/priority-queue-in-c) [WayBackMachine for **A Generic Binary Heap Class**](https://web.archive.org/web/20160821131547/http://www.informit.com/guides/content.aspx?g=dotnet&seqNum=789) – Henrik Ginnerup Apr 21 '22 at 08:52
0
            
            
        I like using the OrderedBag and OrderedSet classes in PowerCollections as priority queues.
 
    
    
        saeed
        
- 2,477
- 2
- 23
- 40