Collection - Sequence (Ordered)
Table of Contents
1 - About
A sequence is an abstract collection:
- of non-unique element
non-unique means that it allows duplicate member (the same element/value may occur more than once).
Order matter for equivalence | Duplicate is allowed | Collection Type |
---|---|---|
false | false | set |
false | true | Bag |
true | false | OrderedSet |
true | true | Sequence |
2 - Articles Related
3 - Example
- (M, A, R, Y) is a sequence of letters with the letter M first and Y last.
- (M, A, R, Y) differs from (A, R, M, Y)
4 - Properties
4.1 - Rank / Index
The position of an element in a sequence is its rank or index.
4.2 - Cardinality
Collection - Cardinality (Size/Length) - In computer science
4.2.1 - Finite
A finite sequence is called a list
4.2.2 - Infinite
A infinite sequence is called a stream and is generally read through a iterator pattern.
4.3 - Access type
It's a data structures with no or slow random access.