<p>As I wrote in the comments, I'd call it a <strong>contiguous subsequence</strong>.</p>

CC BY-SA 2.5
2011-03-14T17:33:29.507Z
2011-03-14T17:33:29.507Z
Dave Clarke
<p>I suggest the term <strong>segment</strong>. </p>

CC BY-SA 2.5
2011-03-14T22:55:24.673Z
2011-03-14T22:55:24.673Z
Oleksandr Bondarenko
<p>In string algorithms, the most established usage is <strong>subsequence</strong> for the non-contiguous case, and either <strong>substring</strong>, <strong>factor</strong> or <strong>window</strong> for the contiguous case. Incidentally, <strong>string</strong> and <strong>sequence</strong> are usually regarded as synonyms (with "sequence" having a bit more biological flavour, but otherwise equivalent). The elements are called <strong>characters</strong>, but depending on the context, could in fact be integers or anything else, and the same terminology would be used.</p>

<p>The Mathematica system goes against this established usage by having the functions <em>LongestCommonSequence</em> and <em>LongestCommonSubsequence</em> that represent the non-contiguous and the contiguous case respectively. The Mathematica documentation uses the term "scattered" for "non-contiguous".</p>

CC BY-SA 2.5
2011-03-19T11:24:17.930Z
Thanks for the detailed answer! I went with substring eventually
Thomas Levesque
CC BY-SA 2.5
2011-03-18T14:05:07.340Z
2011-03-18T14:41:46.013Z
2011-03-18T14:41:46.013Z
Alexander Tiskin
<p>In programming languages and libraries, it is usually called either a <strong>substring</strong> or a <strong>slice</strong>.</p>

<p>The former term is ubiquitous, and I would not mind using it even if your "characters" are a bit weird.</p>

<p>The latter term is neutral in the sense that it does not refer to strings. See <a href="http://en.wikipedia.org/wiki/Array_slicing" rel="noreferrer">array slicing in Wikipedia</a> for more information and examples.</p>

CC BY-SA 2.5
2011-03-14T22:28:32.810Z
2011-03-14T22:35:40.650Z
2011-03-14T22:35:40.650Z
Jukka Suomela
<p>I wrote a function that returns the position of a given subsequence in a sequence. However, I just realized that I used the term "subsequence" incorrectly: according to <a href="http://en.wikipedia.org/wiki/Subsequence" rel="nofollow">Wikipedia</a>, the elements of a subsequence don't need to be consecutive. But my function is actually looking for a "subsequence of consecutive elements"... is there a name for this notion? I thought of <em>substring</em>, but it seems to imply a sequence of <em>characters</em>, and my function is not specific to character strings..</p>

<p>I realize it isn't a very critical issue, but I'd like to give my function an accurate name...</p>

<p>Any idea would be appreciated !</p>

CC BY-SA 2.5
2011-03-14T11:33:40.337Z
Contiguous subsequence
Dave Clarke
CC BY-SA 2.5
2011-03-14T11:41:31.997Z
This site is devoted to research-level theoretical computer science. As such, your question falls out of scope. Hopefully, my answer is nevertheless sufficient.
Dave Clarke
CC BY-SA 2.5
2011-03-14T12:27:44.333Z
Thomas, I agree with Dave, I think this question would be more suitable for StackOverflow (another alternative is Math.SE), would you like us to migrate it to one of them?
Kaveh
CC BY-SA 2.5
2011-03-14T12:31:13.800Z
ps: subsequence is not an incorrect name, it contains your case, and I think it is not uncommon in some programming languages to use it in the sense you are using it. A possible alternative would be *range* or *interval*, but IMHO (contiguous) subsequence is better.
Kaveh
CC BY-SA 2.5
2011-03-14T13:43:41.323Z
@Dave, Kaveh, thanks for your comments. I thought CSTheory would be better suited for this question, but apparently I was wrong...
Thomas Levesque
CC BY-SA 2.5
2011-03-14T13:44:56.220Z
@Kaveh, I agree that "subsequence" contains my case, but my function will *not* find a non-consecutive subsequence, that why I'm looking for a more specific name... And yes, please migrate the question to SO if you think it's better
Thomas Levesque
CC BY-SA 2.5
2011-03-14T13:46:44.330Z
@Kaveh: Thomas has an answer, so there's no need to migrate. @Thomas: the level of your question is the issue; you are merely asking for the name of some concept. This is not a research issue, per se.
Dave Clarke
CC BY-SA 2.5
2011-03-14T13:58:38.993Z
@Dave, understood, thank for the clarification
Thomas Levesque
CC BY-SA 2.5
2011-03-14T13:58:38.997Z
Your subsequences are called arithmetic progressions. See e.g. http://en.wikipedia.org/wiki/Arithmetic_progression E.g. the Green-Tao theorems states that the sequence of prime numbers contain arbitrarily long arithmetic progressions.
Martin Schwarz
CC BY-SA 2.5
2011-03-14T14:01:01.923Z
@Martin, absolutely not... I'm working on arbitrary sequences, there is no arithmetic relation between the elements. And the elements can be of any type, they don't even have to be numbers...
Thomas Levesque
CC BY-SA 2.5
2011-03-14T15:28:32.393Z
@Dave: I disagree that this is off topic.  I started a [discussion on meta](http://meta.cstheory.stackexchange.com/questions/1056/question-how-do-you-call-a-subsequence-of-consecutive-elements).
Tsuyoshi Ito
CC BY-SA 2.5
2011-03-14T17:10:08.853Z
I believe substrings are by default contiguous, whereas subsequences are not. So "contiguous subsequence" is probably the best name.
Peter Shor 
CC BY-SA 2.5
2011-03-14T17:15:32.197Z
By popular demand, the question has been reopened.
Dave Clarke
CC BY-SA 2.5
2011-03-14T18:39:48.497Z
substring works for me ;)
Suresh Venkat
<terminology>
How do you call a subsequence of consecutive elements ?
Thomas Levesque
# How do you call a subsequence of consecutive elements ?

(Asked by: username_0 on 2011-03-14)

I wrote a function that returns the position of a given subsequence in a sequence. However, I just realized that I used the term "subsequence" incorrectly: according to [Wikipedia](http://en.wikipedia.org/wiki/Subsequence), the elements of a subsequence don't need to be consecutive. But my function is actually looking for a "subsequence of consecutive elements"... is there a name for this notion? I thought of *substring*, but it seems to imply a sequence of *characters*, and my function is not specific to character strings..

I realize it isn't a very critical issue, but I'd like to give my function an accurate name...

Any idea would be appreciated !

**Tags:** terminology
> **Comments:**
> **username_1**: Contiguous subsequence  
> **username_1**: This site is devoted to research-level theoretical computer science. As such, your question falls out of scope. Hopefully, my answer is nevertheless sufficient.  
> **username_2**: Thomas, I agree with Dave, I think this question would be more suitable for StackOverflow (another alternative is Math.SE), would you like us to migrate it to one of them?  
> **username_2**: ps: subsequence is not an incorrect name, it contains your case, and I think it is not uncommon in some programming languages to use it in the sense you are using it. A possible alternative would be *range* or *interval*, but IMHO (contiguous) subsequence is better.  
> **username_0**: @Dave, Kaveh, thanks for your comments. I thought CSTheory would be better suited for this question, but apparently I was wrong...  
> **username_0**: @Kaveh, I agree that "subsequence" contains my case, but my function will *not* find a non-consecutive subsequence, that why I'm looking for a more specific name... And yes, please migrate the question to SO if you think it's better  
> **username_1**: @Kaveh: Thomas has an answer, so there's no need to migrate. @Thomas: the level of your question is the issue; you are merely asking for the name of some concept. This is not a research issue, per se.  
> **username_0**: @Dave, understood, thank for the clarification  
> **username_3**: Your subsequences are called arithmetic progressions. See e.g. http://en.wikipedia.org/wiki/Arithmetic_progression E.g. the Green-Tao theorems states that the sequence of prime numbers contain arbitrarily long arithmetic progressions.  
> **username_0**: @Martin, absolutely not... I'm working on arbitrary sequences, there is no arithmetic relation between the elements. And the elements can be of any type, they don't even have to be numbers...  
> **username_4**: @Dave: I disagree that this is off topic.  I started a [discussion on meta](http://meta.cstheory.stackexchange.com/questions/1056/question-how-do-you-call-a-subsequence-of-consecutive-elements).  
> **username_5**: I believe substrings are by default contiguous, whereas subsequences are not. So "contiguous subsequence" is probably the best name.  
> **username_1**: By popular demand, the question has been reopened.  
> **username_6**: substring works for me ;)  

---

## 4 answers

### Answer by username_9 on 2011-03-14. Score: 9 | Accepted answer

In programming languages and libraries, it is usually called either a **substring** or a **slice**.

The former term is ubiquitous, and I would not mind using it even if your "characters" are a bit weird.

The latter term is neutral in the sense that it does not refer to strings. See [array slicing in Wikipedia](http://en.wikipedia.org/wiki/Array_slicing) for more information and examples.


---

### Answer by username_1 on 2011-03-14. Score: 7

As I wrote in the comments, I'd call it a **contiguous subsequence**.


---

### Answer by username_7 on 2011-03-14. Score: 6

I suggest the term **segment**.


---

### Answer by username_8 on 2011-03-18. Score: 3

In string algorithms, the most established usage is **subsequence** for the non-contiguous case, and either **substring**, **factor** or **window** for the contiguous case. Incidentally, **string** and **sequence** are usually regarded as synonyms (with "sequence" having a bit more biological flavour, but otherwise equivalent). The elements are called **characters**, but depending on the context, could in fact be integers or anything else, and the same terminology would be used.

The Mathematica system goes against this established usage by having the functions *LongestCommonSequence* and *LongestCommonSubsequence* that represent the non-contiguous and the contiguous case respectively. The Mathematica documentation uses the term "scattered" for "non-contiguous".

> **Comments:**
> **username_0**: Thanks for the detailed answer! I went with substring eventually  

---

