SlideServe
Menu
Préférences
© SlideServe · v2026

Sequences

babu avatar
15 diapositives · 393 Views · Sep 04, 2014

Sequences. What is sequence?. A sequence is an ordered collection of objects. We use sequences to model collections in which order or multiplicity is important. If we do not wish to impose an order, then we may choose to use bags instead.

Sequences - slide 1
01 / 15Sequences
1 / 17

Télécharger la présentation

Sequences
Une image / un lien ci-dessous est fourni (tel quel) pour télécharger la présentation

Politique de téléchargement : le contenu du site vous est fourni TEL QUEL pour votre information et votre usage personnel ; il ne peut être vendu, concédé sous licence ni partagé sur d’autres sites sans l’accord de son auteur.Le contenu vous est fourni TEL QUEL, pour votre information et votre usage personnel uniquement. Téléchargez la présentation en cliquant sur ce lien. Lors du téléchargement, si vous ne parvenez pas à télécharger une présentation, l’éditeur a peut-être supprimé le fichier de son serveur.Pendant le téléchargement, si vous ne parvenez pas à obtenir une présentation, le fichier a peut-être été supprimé par l’éditeur.

F I N

Plus de contenu associé

Transcription de la présentation
  1. Sequences

  2. What is sequence? • A sequence is an ordered collection of objects. • We use sequences to model collections in which order or multiplicity is important. • If we do not wish to impose an order, then we may choose to use bags instead. • A sequence of values of type X is a partial function from natural numbers N to X whose domain is just 1..n, where n is the length of the sequence. • Formally we can define the set of all sequences of values of type X as follows: seq X == { f : N ↛X | (n : N • dom f = 1..n)}

  3. Since seq X is a set of functions, the typeofseq X must be ℙ (ℙ(ℤ  X)) • The type of any sequence of values of type X is ℙ(ℤ  X) • The following notation denote a sequence: {1↦u, 2 ↦s, 3 ↦i, 4 ↦n, 5 ↦g, 6 ↦z} ‹u,s,i,n,g,z› ‹› empty sequence

  4. If we let s denotes the above sequence, then the following statements are well-formed and true: dom s = 1..6 ran s = {u,s,i,n,g,z} #s = 4 s 4 = n

  5. Sequence notation

  6. Sequence notation

  7. Sequence notation

  8. Sequence notation • last s = s #s • front s = {#s} s

  9. Filter • If s is a sequence, then s ↾ A is the largest subsequence of s containing only those objects that are elements of A. <a, b, c, d, e, d, c, b, a> ↾ {a, b} = <a, b, b, a>

  10. Question

  11. Sequences as function

  12. Concatenation

  13. Bag • A bag is an unordered collection of objects in which multiplicities are important: [[ ]] [[a, b, c, a, b, c]]