简体   繁体   English

列表的前N个元素的用语是什么?

[英]What is the term for the first N elements of a list?

The first element of a list is called a head, and the rest of a list is its tail. 列表的第一个元素称为头,列表的其余部分为尾。 But what is the term for a sublist that consists of first N elements of a list? 但是,由列表的前N个元素组成的子列表的术语是什么? And what is the name for the rest of the list after N'th element? 第N个元素之后的其余列表的名称是什么?

Actually, in a rather large subset of linked list implementations, the tail is actually the last element rather than the list sans the head :-) 实际上,在链接列表实现的相当大的子集中,尾部实际上是最后一个元素,而不是列表没有头:-)

Since there appears to be little consensus (after two years) as to what you should call the initial subset, you can name it whatever you like as long as it's clear, for example: 由于在最初的子集上似乎没有共识(两年后),因此只要清楚就可以随意命名,例如:

  • initial subset of size N; 大小为N的初始子集;
  • first N elements; 前N个元素;
  • initial-N. 初始-N。

I would actually call the rest of the list just the remainder, since you'll almost always be using it in the context of what you're discussing. 实际上,我将其余部分称为列表的其余部分,因为您几乎总是在讨论的内容中使用它。

So, for example, the head has a remainder of all but the head, and the initial subset of size N has a remainder of the list minus those N elements. 因此,例如,头部除头部之外其余全部,并且大小为N的初始子集具有列表的其余部分减去这N元素。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM