如何通过使用优先级队列创建排序的链表功能 [英] how to create a sorted linked list function by using priority queues

查看:202
本文介绍了如何通过使用优先级队列创建排序的链表功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的意思是通过在链接列表类中给它们优先级来对每个元素进行排序,如果首先排序一个元素,而不是将其设置为我尝试过但未得到结果的队列的开头

i mean sort each element by giving them priority in linked list class, if one element is sorted first than set it to the beginning of the queue i tried but didn''t get that result

推荐答案

CodeProject是您的朋友:请参阅:在C#中借助堆数据结构的优先级队列",作者Alexey Kurakin,2011年5月[
CodeProject is your friend: see: "Priority queue in C# with the help of heap data structure" by Alexey Kurakin, May 2011[^].

I''d decompose your solution into two parts: one implementing a priority queue, and then the task of creating/refreshing a Linked List sorted based on the priority queue.


这篇关于如何通过使用优先级队列创建排序的链表功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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