Talk:Heap (data structure)

message: The articles about heaps keep switching from min to max heaps and back (e.g. in this article the definition is for max heap while the complexity is for min heap.) I think we use consistently min-heap (or max-heap) and say in ONE place the other is just the opposite. What do you think? Jirka6 18:38, 25 February 2007 (UTC)
replies: text: I agree. Bender2k14 (talk) 00:06, 15 October 2009 (UTC)
thread_title:  Unifying heaps 

message: I was under the impression that heaps must also be complete trees...that is...the last level of the tree must be filled with a left to right ordering but maybe this is not true for all heaps...
:That only holds for binary heaps. --Mellum 09:59, 3 Dec 2004 (UTC)
replies: text: Imagine a scenario where the bottom level is completely full. If a new node were to be added to the heap, how could it maintain the property of being a complete binary tree, since the leftmost node would not be filled at the last level? Sheepdude 19:46, 20 April 2007 (UTC)
replies: text: You are talking about a perfect tree, not a complete tree. See  Types of binary trees. Bender2k14 (talk) 00:16, 15 October 2009 (UTC)

text: Yes, special in the sense that a heap is either a minheap or a maxheap. Bender2k14 (talk) 00:11, 15 October 2009 (UTC)
thread_title:  Definition 

message: You know you guys use the term heapifying in this topic? The topic is a mishmash of stuff in its current revision and I might clean it up like I did with tree (data structure). Hope noone objects. Josh Froelich 16:43, 16 February 2007 (UTC)
thread_title:  heapifying  

message: I'm a graduate level EE who has been working for 20 years - and I don't understand.  Perhaps the explanation could be less circular.  Please keep in mind that this data is used by people who do not already know much about the subject.
:Agreed.  This entry does not read well, and provides no explainations or definitions.  —Preceding unsigned comment added by Chieffancypants (talk • contribs) 03:47, 11 January 2008 (UTC)
thread_title:  confusing  

message: It should be explained what a "key" is, becuase it is in the definition with no explanation, which makes the rest of the article usless to anyone who doesn't already know what a heap is, which in turn makes the article usless for %95 of people visiting the page because if you know what a key is there's only a small chance you don't know what a heap is. There isn't even a link (although, noe that a link to key wouldn't be adequeate in this case, because it is probably possible to give a short non-technical descriptioin of a "key"). 76.175.72.51 (talk) 17:19, 13 April 2009 (UTC)
replies: text: I agree. I don't know what kind of key this article is referring to, and so the introduction is meaningless to me. Could someone please explain what a heap key is? 75.72.9.174 (talk) 20:09, 21 December 2013 (UTC)

text: Yes, "key" is one of several problems in the first paragraph [July2015 version]. A definition of "heap" should be given in the first paragraph.  In my last LISP class this page developed into a source of jokes: "if you don't know what you are talking about, elevate the discussion to things that no one knows" and "now politicians will tell us about data structures", etc. wrstark (talk) 15:28, 22 July 2015 (UTC)
thread_title: Key needs to be explained in the definition

message: I just removed the claim that heaps can be used to find the max, min, both the max and min, median, or k-th largest element in sublinear time because that is not true.  You have to look at each element at least once, so the running time is at least linear. Bender2k14 (talk) 00:20, 15 October 2009 (UTC)
replies: text: I'm pretty sure that the sublinear claim refers to finding these elements after the heap has been constructed. Otherwise that claim would be pointless, and should be removed altogether. Paradoctor (talk) 06:45, 10 November 2009 (UTC)

text: The current statement "Finding the min, max, both the min and max, median, or even the k-th largest element can be done in linear time using heaps" also seems spurious. Firstly, you can easily find min, max and both min and max in linear time without using any kind of special data structure. And … can you really find the median in linear time in any way in which a heap is instrumental? (The standard linear median-finding algorithm doesn't use a heap.) You can find the k-th largest element in linear time with a heap 'if' you assume that k is a constant. Otherwise, if you don't want k popping up in the running time, using the same linear selection algorithm as for the median would be the solution. No heap involved, though. The most natural claims to have in this bullet point (related to selection) would be that it can find the k-th largest or smallest item in (for example) O(n lg k) or O(n + k lg k) time. Mlhetland (talk) 19:58, 12 July 2010 (UTC)
replies: text:  I removed the corresponding section according to the above discussion.  --mellum (talk) 13:05, 2 August 2010 (UTC)
replies: text: It's easy to find min/max in O(1) using heaps, and update them in O(ln(n)). You can't do that with the linear algorithm, it takes O(n) each and every time. After thinking about it for a while, I came up with O(1) for finding the median also using min/max heaps that update in O(ln n). But I added a ref tag.- Wolfkeeper 13:53, 2 August 2010 (UTC)
replies: text: I hope you don't mind if I remove it again - the article you're citing refers to finding a median or kth element in constant time for data that's already in a heap.  The O(ln n) time for an update is correct, but when you're constructing the heap you have to do that n times, so it's O(n ln n) for heap construction. Tristanreid (talk) 23:06, 20 February 2013 (UTC)
thread_title: Sublinear Claim

message: Fibonacci queue cites this paper. From the abstract:
I think this should be mentioned here. Paradoctor (talk) 12:01, 7 November 2009 (UTC)
thread_title:  Brodal queue 

message: Is there any particular reason why weak heaps are not mentioned? Maybe this variant is not so well known? --188.126.207.212 (talk) 17:46, 23 August 2010 (UTC)
replies: text: If you can write up something about weak heaps with proper sources, be bold. Qwertyus (talk) 15:04, 19 January 2011 (UTC)
thread_title:  Weak heaps? 

message: I've removed all reference to "Pseudo Queues". I've never heard of them, and the reference given seems to have nothing to do whatsoever with heaps/priority queues. Qwertyus (talk) 15:09, 19 January 2011 (UTC)
thread_title:  Rm pseudo queues 

message: Hi folks,
why is in the pairing heap implementation the insert operation denoted as amortized linear? Shouldn't it be linear without amortized analysis?
Grettings!  —Preceding unsigned comment added by 91.18.86.134 (talk) 16:10, 21 February 2011 (UTC)
replies: text: Because that's the way it's given in the citation. Btw., I've removed all the citation needed tags for the pairing heap operations, since they are all described in the reference given. I'm not going to cite it again in every field of the table. Qwertyus (talk) 10:48, 14 July 2011 (UTC)
thread_title:  Paring Heap Amortized Linear Time Insert Operation 

message: I found this source for the fibonacci heaps, however, it says that every operation is done in amortized time, mind you I haven't read the hole thing. I think is the original paper. Plaga701 (talk) 10:41, 27 July 2011 (UTC)
thread_title:  Fibonacci heaps 

message: I just come across this term from a course slides of MIT OCW, by J.B. Orlin, Network Optimization, spring 2003. I'd like to create a new article to describe this object. However, I can not find a formal public reference now, since my slides at hand is inherited from a senior. In short, this is a heap with all real elements placed in leaves, and all the internal nodes has the value of smaller child. Every operation costs log(n) time. I don't think this structure practical, but it's reasonable to note it here to make a complete article. Can anybody help proceed along this line? Hupili (talk) 09:16, 4 February 2012 (UTC)
thread_title:  Leaf heap 

message: Also from 'J.B. Orlin, Network Optimization, spring 2003.', a specialized data structure to improve Dial's algorithm(an implementation of Dijkstra's shortest path algorithm). Use exponentially growed bucket width to improve find-min procedure.Hupili (talk) 02:48, 5 February 2012 (UTC)
thread_title:  Radix heap 

message: I deleted this line:
Some early popular languages such as Lisp provided dynamic memory allocation using heap data structures, which gave the memory area its name.
The line is mysterious to me because I don't see how heaps (the data structure) are useful in the context of memory management.  What would the heap property be?  Early Lisp implementations generally used mark-and-sweep to reclaim memory.
It was added by an anonymous editor (IP 82.180.29.126) on 20 April 2011.   It was justified by a footnote to Cormen etal, but here is what Cormen etal. actually says:
We note that the term "heap" was originally coined in the context of heapsort, but it has since come to refer to "garbage-collected storage" such as the languages Lisp and Java provide.  Our heap data structure is not garbage-collected storage, and whenever we refer to heaps in this book, we shall mean the structure defined in this chapter.
In The Art of Computer Programming, Vol. 1, 2nd Ed. p. 435, Knuth says the following on the use of "heap" in the context of dynamic memory:
Several authors began about 1975 to call the pool of available memory a "heap".  But in the present series of books, we will use the word only in its more traditional sense related to priority queues.
I found an article dated 1985 which uses what it calls a "heap data structure" to manage memory in a Forth implementation.  However the data structure described is not the heap which is the topic of this Wikipedia page.
Googling the line shows that it has been repeated multiple times on the web, but none of the references predate the 20 April 2011 Wikipedia edit.  — Preceding unsigned comment added by Grubbiv (talk • contribs) 17:42, 19 August 2012 (UTC)
thread_title:  Origin of Phrase "the Heap" 

message: There's currently a reference to Floyd's algorithm in section Implementation and operations, but there's no mention of an application to heaps on the algorithm's page. I think the linked one is not the correct "Floyd's algorithm" in this case. If so, the link should be removed.  — Preceding unsigned comment added by 77.56.7.92 (talk) 02:27, 8 February 2013 (UTC)
thread_title:  Floyd's algorithm 

message: The running time for Fibonacci heaps appears to contradict between the table at Heap (data structure)#Comparison of theoretic bounds for variants and at Fibonacci heap#Summary of running times. Please check which one is correct.  — Preceding unsigned comment added by Theemathas (talk • contribs) 08:32, 30 October 2013 (UTC)
thread_title:  Contradiction of running times 

message: Could someone replace the absurd link to completeness with an appropriate one?  (I'm not sure which one that would be, or I'd have done it by now.)
: 
I'm amazed that anyone would fail to expect completeness to be a disambiguation page.  Common sense. Michael Hardy (talk) 22:41, 3 May 2014 (UTC)
thread_title:  Link to "completeness" disambiguation page 

message: The common operations are a huge mess at the moment with their naming ranging from abc-xyz to AbcXyz and literally EVERYTHING in between. Also, the parameters are sometimes specified, sometimes not, regardless of weather the function actually takes parameters or not.  — Preceding unsigned comment added by 93.139.145.237 (talk) 05:07, 5 July 2014 (UTC)
thread_title:  Naming of operations 

message: To me, the short definition in the Operations section for heapify is not correct.  It currently states: "heapify: create a heap out of given array of elements".  However, to me this procedure is more for ensuring the heap contract.  CLRS describes a MAX-HEAPIFY method in Section 6.2 ("Maintaining the heap property").  Skiena's Algorithm Design Manual, Section 4.3.3 ("Extracting the Minimum") explains "This percolate-down operation is also called heapify, because it merges two heaps (the subtrees below the original root) with a new key."
I personally find the "create-heap" operation definition ("create-heap: create an empty heap") a bit useless, adding to the confusion around "heapify" ("create a heap out of given array of elements").  To me, "create-heap" (what I would call "build-heap") should use the current definition of "heapify" and a new one presented based on CLRS, Skiena, et al.
Njuk-njuk (talk) 13:05, 21 August 2015 (UTC)
thread_title:  Incorrect short definition for heapify operation 

message: I would like to offer my page of animated illustrations about the Heap (http://www.chrislaux.com/heap.html) for the external links section. I believe the animations explain the Heap nicely visually to go with the text-focussed explanations here.
Ctlaux (talk) 19:02, 3 September 2019 (UTC)
thread_title:  New external links 

message: I'm not a specialist, but is the first image (https://en.wikipedia.org/wiki/Heap_(data_structure)#/media/File:Max-Heap.svg) correct? In the "array representation" part (at image bottom) shouln't be slot with value "17" connecting with "2" and "7", instead of slot with value "3"?
Joint ventura (talk) 18:37, 11 February 2021 (UTC)
replies: text: (For the record), there was apparently a glitch, which got fixed 6 days after you noticed it. AHMartin (talk) 17:55, 15 January 2024 (UTC)
thread_title:  Is first image ("Example of a binary max-heap...") correct? 

message: As a beginner programmer, I was reading this article and was confused by the term "almost complete." There's no definition of the property on this page, and I can only find definitions of "almost complete" as it applies specifically to binary trees. However, it's clearly stated that a heap can be nonbinary. So does "almost complete" mean anything in this context? What exact property of heaps is it meant to describe?
(In addition, even for binary heaps, "almost complete" excludes the "perfect" case, which doesn't seem right at all.)
--66.189.60.1 (talk) 01:09, 7 May 2021 (UTC)
replies: text: Given the existance of the (linked) article binary heap, this Heap page has no business discussing the details of binary heap implementations.  Also, the nomenclature variants for "complete", "perfect", "full", etc. binary trees are discussed in the (linked) article Binary tree § Types_of_binary_trees.  But since "almost complete" is a variant characterization of the tree underlying a binary heap's implementation, I changed it to "complete".  Now this article uses the term consistently.  AHMartin (talk) 18:36, 15 January 2024 (UTC)
thread_title:  Is "almost complete" correct?