I've red that a binary heap can be implemented using a priority queue. I've also red the opposite, that a priority queue can be implemented using a binary heap.
This seems strange to me as conceptually they are different: a priority queue is a linear data structure with a priority assigned to each element, whereas a binary heap is a binary tree whose nodes are arranged in a certain way.
Is one more fundamental than the other in the sense that it would be better to build one from the other and not the other way around? When thinking about it or coding, what are the benefits and drawbacks of one over the other?
Is it better (in terms of space used or runtime of operations) to not implement one using the other, and that it's often done because most programing languages have one built in but not the other?
priority_queue
is the C++ STL wrapper to change the functionality of an array/vector into that of a priority queue, no doubt using the array as binary heap. $\endgroup$