优先队列中的优先级 [英] Priorities in Priority Queue

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

问题描述

我正在做关于优先队列的面试问题,有一个简单的问题希望得到一些帮助.问题是:

I was doing interview question on priority queues and have a simple question I was hoping to get some help with. The question is:

优先级应该是完整的吗?我可以实现字符串优先级吗.

Should the priorities be integral? Could I implement string priorities.

提前致谢:-)

推荐答案

?

优先级可以是任何定义了偏序的东西,尽管全序会更常见(例如整数或按字典顺序排列的字符串).

The priorities can be anything that have a partial order defined, although a total order would be more common (e.g. integers, or strings ordered lexiographically).

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

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