Download presentation
Presentation is loading. Please wait.
Published byMelvin Bell Modified over 9 years ago
2
A sequence is a list of objects arranged in a specific order. A sequence in computer science is known as an array. An array hold objects of the same type It may be a finite list, containing a specific number of elements or it may be an infinite list. The elements may be different or they may be repeated.
3
Recursive: refers to a previous term 3,8,13,18,23 5 is added to each term to get the next term Explicit: tells what value a particular term has and is not dependent on the previous number.
4
A list of squares called b. b contains: 1 as a term 4 as a term 9 as a term Subscripts are used to indicate the position of a term in a list. b 1 =1 2 b is the name of the list, 1 is the position of the term, the value of the term is 1 2 b 2 =2 2 b is the name of the list, 2 is the position of the term, the value of the term is 2 2
5
The formula for the square list is: b n =n 2 b 1 =1 2 b 2 =2 2 b 3 =3 2 b 4 =4 2 b 5 =5 2 The subscript on the left and the value of n on the right are the same
6
List a 3, 8, 13, 18, 23 a 1 a 2 a 3 a 4 a 5 Formula for this list: A n =A n-1 + 5 where A 1 =3 A is the name of the list, n is the subscript, A n-1 refers to the previous term in the list.
7
A 1 =3 A 2 =A 2-1 +5 A 2 =A 1 +5 A 2 =3+5 A 2 =8 A 3 =A 3-1 +5 A 3 =A 2 +5 A 3 =8+5 A 3 =13 A 4 =A 4-1 +5 A 4 =A 3 +5 A 4 =13+5 A 4 =18 A 5 =A 5-1 +5 A 5 =A 4 +5 A 5 =18+5 A 5 =23
8
Corresponding set is the set of all distinct elements in the sequence. Given the sequence/list: 5,6,5,6,5,6 The set corresponding to the sequence is {5,6}. Given the set {a,b} you could have many kinds of seqeunces. One example would be a,a,b,b,a,b,b,b,a
9
Characteristic function is denoted f In binary code, you have a series of 1’s and 0’s 1 represents on or yes 0 represents off or no The characteristic function of s, of x, = 1 written: fs(X)=1 If X is an element of S, the outcome is 1 If X is not an element of S, the outcome is 0 fs(X) = 0
10
Universal set U={1,2,3,4,5,6} subset A = {1,2} subset B = {2,4,6} subset C = {4,5,6} The universal set has 6 terms. When we compare A to U, the result will have 6 terms When we compare B to U, the result will have 6 terms When we compare C to U, the result will have 6 terms.
11
The characteristic function of a = 110000 written: f A = 110000 U={1,2,3,4,5,6} A={1,2} fA(1) is 1 an ∈ of A -> Yes fA(1) = 1 fA(2) is 2 an ∈ of A -> Yes fA(2) = 1 fA(3) is 3 an ∈ of A -> No fA(3) = 0 fA(4) is 4 an ∈ of A -> No fA(4) = 0 fA(5) is 5 an ∈ of A -> No fA(5) = 0 fA(6) is 6 an ∈ of A -> No fA(6) = 0 f A = 110000
12
U={1,2,3,4,5,6} B={2,4,6} fB=010101 U={1,2,3,4,5,6} C={4,5,6} fC=000111
13
Regular expression (RE): A regular expression over set A is a string created from elements of A. RE1: The symbol ∧ (meaning empty string) is a regular expression. An empty string is contained in the set and is a regular expression RE2: if X ∈ A, the symbol X is a regular expression. The elements of the set are considered regular expressions. RE 3: if and β are regular expressions, then the expression β is regular. In other words, if the elements are in the set and they are next to each other, the expression is considered regular. RE4: if β are regular expressions ∨ β is regular. ∨ means join.
14
RE5: if is a regular expression * (* means finite sequence) is regular. A*: the set of all finite sequences of elements of A *: the set of all finite sequences of elements of
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.