如何实现优先级队列数据结构添加两个多项式表达式? [英] How to implemet priority queue data structure for the addition of two polynomial expression?

查看:74
本文介绍了如何实现优先级队列数据结构添加两个多项式表达式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好。我必须为学校做一个项目。我的任务是选择一个数据结构,用于添加两个多项式表达式,具有高指数和大量空系数。我使用链表数据结构制作了我的程序,但是我的老师告诉我链接列表在这种情况下不如优先级队列数据结构有效。有人能告诉我如何使用c ++语言实现优先级队列以添加两个多项式表达式吗?我的项目是否有更高效的数据结构?



我尝试过:



我的程序基于链表数据结构。

Hello. I have to make a project for school. My task is to choose a data structure for the addition of two polynomial expression, with high exponents and lots of null coefficients. I made my program using linked list data structure, but my teacher told my that linked list is not as efficient as the priority queue data structure in this case. Can somebody give me a clue how to implement a priority queue for the addition of two polynomial expression using c++ language? Are there more efficient data structure for my project?

What I have tried:

My program is based on the linked list data structure.

推荐答案

参见优先级队列数据结构 - Google搜索 [ ^ ]。


你真的确定你需要实现优先级队列,而不仅仅是使用可用的?



优先级队列已在C ++标准库中实现, std :: priority_queue

priority_queue - C ++参考



-SA
Are you really sure you need to implement priority queue, not just use available one?

Priority queue is already implemented in a C++ standard library, std::priority_queue:
priority_queue — C++ Reference.

—SA


这篇关于如何实现优先级队列数据结构添加两个多项式表达式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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