且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

“a"和“a"之间的关系是什么?堆和“the"堆?

更新时间:2023-11-20 20:19:16

老实说,没什么.我可以想象 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...