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

查看:23
本文介绍了“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天全站免登陆