什么是隐式数据结构?而堆是实现优先级队列的隐式数据结构吗?
我的问题可能看起来很幼稚,但我真的不明白这个问题,因为我只是数据结构课程的新手。我确实知道最大和最小堆如何工作,但我不确定堆是否是实现优先级队列的隐式数据结构。
My question might seem childish but I really don't understand this question as I am just a newbie to data structures course. I do know how max and min heap work, but I am not sure that whether heap is implicit data structure to implement priority queue.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
维基百科已备份:D
来自文章:
所以是的,堆符合要求,因为它可以实现为简单的数组。实现优先级队列的堆将是隐式数据结构,但不是因为它实现了优先级队列。这是因为堆不使用任何特殊的东西来跟踪其元素,仅使用数组位置。
另外,我完全不同意你朋友的解释。任何问题都没有“自然”的数据结构,只有在特定情况下恰好非常方便的数据结构。
计算和数据结构是抽象概念,可以通过多种不同方式实现。链表可以在堆上、在硬盘上、在互联网上、以一堆带有便签和下一个人的电话号码的人的形式实现。将它们的整个集合称为用于某些特定问题的“自然”数据结构是错误的。
Wikipedia is back up :D
From the article:
So yes, a heap would fit the bill because it can be implemented as a simple array. A heap that is implementing a priority queue would be an implicit data structure, but not because it's implementing a priority queue. It's because heaps don't use anything special to keep track of its elements, only the array location.
Also, I completely disagree with your friend's interpretation. There is no "natural" data structure for any problem, only ones that happen to be very convenient under the circumstances.
Computing and data structures are abstract ideas that can be implemented in many different ways. A linked list can be implemented on the heap, on the hard drive, over the internet, and in the form of a bunch of people with sticky notes and the next person's phone number. Calling the whole set of them a "natural" data structure to use for some particular problem is wrong.