# [ACCEPTED]-What's the relationship between "a" heap and "the" heap?-definition

Nothing much, to be honest. I would imagine 30 that the word *heap* was simply taken with it's 29 everday (non-technical) usage and applied 28 to these two concepts individually as reasonably 27 good analogies.

In the first case (tree data 26 structure meaning), the description *heap* is 25 most appropiate because "greater" objects 24 are placed higher up in the tree (where 23 "greater" is determined by an 22 arbitrary key function) - i.e. there's a 21 sort of piling of smaller objects on top 20 of larger ones (or larger on top, depending 19 how you think of it). This is just how I'd 18 interpret it; whoever first applied the 17 name *heap* to this data-structure thought it 16 was an appropiate name in his mind, and 15 it's just stuck.

In the second case (chunks 14 of RAM), the name of heap is maybe a bit 13 more evident. "Heap" is just "a 12 large collection of things in a highly arbitrary 11 order" here, which would seem to apply 10 just as well in common usage as it does 9 to dynamically allocated chunks of memory.

In 8 any case, I wouldn't worry about the abstract 7 metaphorical similarities you can draw between 6 the two ideas. Treat them completely seperately 5 and you won't go wrong in any situation.

**Edit:** It 4 seems the tree-based data structure *may* have 3 taken its name from the heap of abstract algebra, as 2 is reasonably common within computer science. However, I 1 wouldn't want to confirm or deny this...

See this very site for an exploration of the origin of the name "heap" for the free 1 store of memory.

They both have the same name, that's about 2 it.

There 'the heap' is never arranged as 1 an actual heap data structure.

The heap (datastructure) is called like 9 that because if you draw it it looks like 8 a heap. The heap (memory) is called a heap 7 because it is somehow organized but not 6 fully. You accumulate data on a heap but 5 you might have holes in it and irregularities. It's 4 as if you'd put papers on a heap. Sometimes 3 you remove one from the bottom. This has 2 a form of a heap, i.e. somehow organized 1 but not fully.

They...have the same name! That's it.

0

The only relationship between the two is 1 the name "heap."

Nothing. No relation.

0

To futher complicate the question: on some 6 systems (e.g. Microsoft Windows), there 5 are multiple "heaps" in the memory 4 allocation sense. "The" heap is 3 merely the *default* heap. But if you call `HeapAlloc()`

, you can choose 2 from which memory allocation you want a 1 sub-allocation.

Definition from answers.com

Heap: A group 9 of things placed or thrown, one on top of 8 the other: a heap of dirty rags lying in 7 the corner.

It's just basic naming due to 6 the conceptual image of throwing things 5 in an unordered fashion. As other posters 4 point out, the heap is not organized as 3 a heap data structure. That depends on the 2 memory allocation routines in your system 1 library (eg. check how malloc works)

More Related questions

We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.