在.net中的优先级队列 [英] Priority queue in .Net

查看:229
本文介绍了在.net中的优先级队列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要寻找一个.NET实现优先级队列或堆数据结构

I am looking for a .NET implementation of a priority queue or heap data structure

优先级队列数据结构提供了比简单的分类更具灵活性,因为它们允许新的元素,在任意时间间隔进入系统。这是更经济有效,插入一个新的工作进入一个优先级队列,而不是重新排序一切上每一个这样的到来。

Priority queues are data structures that provide more flexibility than simple sorting, because they allow new elements to enter a system at arbitrary intervals. It is much more cost-effective to insert a new job into a priority queue than to re-sort everything on each such arrival.

基本的优先级队列支持三种主要操作:

The basic priority queue supports three primary operations:

      
  • 插入(Q,X)。给定的x具有关键字k的项,将它插入到优先级队列中。Q
  •   
  • 找到最小(Q)。返回一个指向该项目   其关键值比在优先级队列中的任何其他键小   Q值。
  •   
  • 删除最小(Q)。从优先级队列Q,其关键是最小删除项目
  •   
  • Insert(Q,x). Given an item x with key k, insert it into the priority queue Q.
  • Find-Minimum(Q). Return a pointer to the item whose key value is smaller than any other key in the priority queue Q.
  • Delete-Minimum(Q). Remove the item from the priority queue Q whose key is minimum

除非我找错了地方,没有一个框架中。有没有人知道一个很好的,或者我应该推出自己的?

Unless I am looking in the wrong place, there isn't one in the framework. Is anyone aware of a good one, or should I roll my own?

推荐答案

我喜欢使用OrderedBag和OrderedSet类 PowerCollections 为优先级队列。

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

这篇关于在.net中的优先级队列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆