"a"和"a"之间的关系是什么?堆和"the"堆? [英] What's the relationship between "a" heap and "the" heap?

查看:195
本文介绍了"a"和"a"之间的关系是什么?堆和"the"堆?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

堆是一种树数据结构,树的较高级别始终包含比较低级别更大(或更小,如果以这种方式设置)的值. 堆"是一堆可用RAM,程序可以将它们用于动态分配.它们都被称为堆",但是一个与另一个有什么关系?

A heap is a tree data structure where higher levels of the tree always contain greater (or lesser, if it's set up that way) values than lower levels. "The" heap is a bunch of free RAM that a program has available for dynamic allocation. They're both called "heap," but what does the one have to do with the other?

推荐答案

说实话,没什么.我可以想象 heap 一词是在日常(非技术性)用法中被简单地使用的,并作为合理的良好比喻单独应用于这两个概念.

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

在第一种情况下(树数据结构的含义),描述 heap 最合适,因为更大"的对象放置在树的上方(其中更大"由任意键确定)函数)-即在较大的对象(或较大的对象,取决于您的想法)之上有一种较小的对象堆积.这就是我的解释方式.谁首先在此数据结构中使用名称​​ heap 的人都认为这是他脑海中的合适名称,但它只是卡住了.

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

在第二种情况下(RAM块),堆的名称可能更明显.这里的堆"只是以高度任意的顺序排列的大量事物",在动态分配的内存块中,它的用法似乎与普通用法一样好.

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

无论如何,我都不会担心您可以在两个想法之间得出抽象的隐喻相似性.完全分开对待它们,在任何情况下您都不会出错.

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

看来基于树的数据结构可能取自

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

这篇关于"a"和"a"之间的关系是什么?堆和"the"堆?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆