954,498 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Heap Data Structure

If I were to implement a heap constructed of integer values, does it matter that the root is not the smallest value? In my algorithm book it always shows the root being the smallest value given. But the Wiki entry shows the root as being the largest value.

jaden403
Newbie Poster
17 posts since May 2006
Reputation Points: 10
Solved Threads: 0
 

>does it matter that the root is not the smallest value?
If you designed it to be then yes, because that's a bug in your implementation. But as you describe the problem, your book is showing a min heap and the wiki article is showing a max heap. Both are variations of the heap priority property.

Narue
Bad Cop
Administrator
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You