I read that priority queue is an abstract data type for heap data structure or to put it in another way, heap is an implementation for priority queues. But what confuses me is that I see heap in itself as an ADT since they're normally implemented using arrays (talking about min/max heaps here). Could someone give me a clear distinction among the three within the realm of ADT?
1 Answers
Let me answer you in two steps..
i) Defenitions
Data type is a set of values together with operations on that type. Almost any noun can give rise to a data type.
Example: integer, date, string, complex number, paragraph, bond, image, set, bag, vector, list, stack, queue, deque, priority queue, ring, dictionary, tree, graph.
There are a variety of constructs which are technically data types but are "low-level" in the sense that their operations are partially specified. For example, a binary search tree "implements" a set by performing lookups, insertions and deletions by "navigating left and right" — but the meanings of left and right depend on whether the items in the tree are stored in an array or are linked together.
Example: binary search tree, AVL tree, B-tree, heap, pairing heap, hashtable, splay tree, trie, R-tree
ii) Conclusion regard to your question
both priority queues & heaps are data types (more accurate; abstract data type or ADT) but because heap Implemented by priority queues, we can consider it data structure.
The heap is one maximally efficient implementation of an abstract data type called a priority queue, and in fact priority queues are often referred to as "heaps", regardless of how they may be implemented. Note that despite the similarity of the name "heap" to "stack" and "queue", the latter two are abstract data types, while a heap is a specific data structure, and "priority queue" is the proper term for the abstract data type.
Note: my answer comes from below references: