Editing Sequence

Jump to: navigation, search

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision Your text
Line 10: Line 10:
 
While in theory, then, a sequence, list, or stream is merely countably many individual values regarded as a whole, the terms ''list'' and ''stream'' often carry the connotations that they do not support random access efficiently, or perhaps at all. Hence, in certain programming languages, a sequence allowing efficient random access is stored and referred to as an [[array]], a sequence supporting only sequential access is stored as a [[linked list]] but often simply referred to as a ''list'', and a (possibly infinite) sequence in which not all the elements might be available right away, such as the sequence of bytes representing standard input, typed on the terminal, is considered a ''stream''. (In a lazy language, such as Haskell, the distinction between the latter two is lost.) We shall assume that the data structure used to represent a sequence is the most appropriate one for the job whenever we discuss algorithms involving sequences.
 
While in theory, then, a sequence, list, or stream is merely countably many individual values regarded as a whole, the terms ''list'' and ''stream'' often carry the connotations that they do not support random access efficiently, or perhaps at all. Hence, in certain programming languages, a sequence allowing efficient random access is stored and referred to as an [[array]], a sequence supporting only sequential access is stored as a [[linked list]] but often simply referred to as a ''list'', and a (possibly infinite) sequence in which not all the elements might be available right away, such as the sequence of bytes representing standard input, typed on the terminal, is considered a ''stream''. (In a lazy language, such as Haskell, the distinction between the latter two is lost.) We shall assume that the data structure used to represent a sequence is the most appropriate one for the job whenever we discuss algorithms involving sequences.
  
We shall usually write sequences as their terms in order, separated by commas, and enclosed by square brackets, ''e.g.'', <math>[x, y, z, ...]</math> where <math>x</math> is the first element, <math>y</math> is the second, and so on. The empty sequence is denoted <math>[\,]</math>.
+
We shall usually write sequences as their terms in order, separated by commas, and enclosed by square brackets, ''e.g.'', <math>[x, y, z, ...]</math> where <math>x</math> is the first element, <math>y</math> is the second, and so on. The empty sequence is denoted <math>[]</math>.
  
 
A sequence over a totally ordered set is said to be '''increasing''' if no element is less than the element preceding it (if any). If every element is greater than the element preceding it (unless no such element exists), then the sequence is said to be '''strictly increasing'''. Some authors argue that the term ''increasing'' is misleading because sequences such as <math>[1,1,1,1,...]</math> are considered increasing under this definition, and prefer '''nondecreasing''' (because the sequence ''never'' decreases). However, all authors agree that the terms '''decreasing''' and '''strictly decreasing''' have meanings opposite to ''increasing'' and ''strictly increasing'', respectively, which leads some authors to counter that the terminology ''nondecreasing'' is misleading because the suggested meaning is ''any sequence that is not decreasing'' (such as <math>[1,2,1,2,1,2]</math>, which is neither an increasing nor a decreasing sequence). Because there is no consensus in usage the reader is advised to mind the context in which these terms appear.
 
A sequence over a totally ordered set is said to be '''increasing''' if no element is less than the element preceding it (if any). If every element is greater than the element preceding it (unless no such element exists), then the sequence is said to be '''strictly increasing'''. Some authors argue that the term ''increasing'' is misleading because sequences such as <math>[1,1,1,1,...]</math> are considered increasing under this definition, and prefer '''nondecreasing''' (because the sequence ''never'' decreases). However, all authors agree that the terms '''decreasing''' and '''strictly decreasing''' have meanings opposite to ''increasing'' and ''strictly increasing'', respectively, which leads some authors to counter that the terminology ''nondecreasing'' is misleading because the suggested meaning is ''any sequence that is not decreasing'' (such as <math>[1,2,1,2,1,2]</math>, which is neither an increasing nor a decreasing sequence). Because there is no consensus in usage the reader is advised to mind the context in which these terms appear.

Please note that all contributions to PEGWiki are considered to be released under the Attribution 3.0 Unported (see PEGWiki:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!

Cancel | Editing help (opens in new window)