You are here:

- Home
- Computing/Technology
- C/C++
- C++
- Is heap an implicit data structure to implement priority queue?

Advertisement

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 hip work, but I am not sure that whether heap is implicit data structure to implement priority queue.

Kindly clear my confusion.

Thanks...

Alan

I too don't really understand what the term 'an implicit data structure' means.

Perhaps, the question should have been: 'Is some kind of heap the only data structure that can be used to implement a priorority queue'?

The answer is no.

"It is a common misconception that a priority queue is a heap. A priority queue is an abstract concept like "a list" or "a map"; just as a list can be implemented with a linked list or an array, a priority queue can be implemented with a heap or a variety of other methods.

...

While relying on a heap is a common way to implement priority queues, for integer data faster implementations exist (this can even apply to datatypes that have finite range, such as floats)"

- Wiki http://en.wikipedia.org/wiki/Priority_queue

my primary areas of interest are generic and template metaprogramming, STL, algorithms, design patterns and c++11. i would not answer questions about gui and web programming.

about 15 years or so**Education/Credentials**

post graduate engineer