0% found this document useful (0 votes)
28 views22 pages

Lecture2A Annotations

Uploaded by

z5y6k4r4r2
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views22 pages

Lecture2A Annotations

Uploaded by

z5y6k4r4r2
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 22

Basic Information

• Instructor: Ruth Urner ([email protected])

• Emails: start your subject line with [eecs2001].

• Office Hours: TBA.

• Website: All course related information is available on eClass.

• Q&A: There is a discussion forum set up on eClass; please use


this for questions that might also be relevant to other students;
please help out and also answer questions; I will monitor the forum,
but there is no grade attached, so don’t hesitate to participate!
Evaluation (to be confirmed on eClass)

4 Assignments (30%)
• Spaced throughout the term
• Dates are announced on eClass (might shift if needed, but the
posted dates help when to expect the assignments)
In-person Midterm exam (30%)
• Expect in the week after reading week
• Date to be announced once we have a time and room
In-person Final exam (40%)
• Date to be scheduled by the university
• Examination period: December 5-20
How to define sets

Here are some tools for defining sets:


1. Make a list of the elements
▶ Set of all students in this class
▶ Set of odd natural numbers smaller than 10: {1, 3, 5, 7, 9}
Problem: this technique fails for large or infinite sets
2. Identify by a common characteristic
▶ Odd natural numbers {n ∈ N | n is not divisible by 2}
Problem: sometimes we don’t know a precise defining characteristic
3. Inductive definition
▶ We can define the natural numbers inductively by stating that
1 ∈ N, and that n ∈ N implies n + 1 ∈ N.
Sets, multi-sets, sequences

• Recall: Sets contain each element only once and the order
does not matter.

• Multi-sets can contain elements multiple times, but do not


contain an order of their elements.

• Sequences or tuples are collections of elements in a fixed order.


Functions – important properties
We use the notation
f :A→B
to state that f is a function from A to B.

We call A the domain of the function f and B the range of the


function f .

Functions can be:


• one-to-one:
We call a function f : A → B one-to-one if f (a) = b and f (a′ ) = b for
some b ∈ B implies that a = a′ .
• onto:
We call a function f : A → B onto if for all b ∈ B there exists an a ∈ A
with f (a) = b.
Graphs

We illustrate graphs as points and connecting lines:


4

1
2

An undirected graph (or simply a graph) G = (V , E ) is defined as a pair of


• a set V of vertices (also called nodes)
• and a set E of edges,
where each edge in E is a (multi-set) subset of V of size 2.
Graphs

Graphs can be used to illustrate relations between objects.


Some definitions and terminology for graphs

5
Let G = (V , E ) be a graph. We define:
1
2
• a vertex v ∈ V is adjacent to edge
e ∈ E if v ∈ e 3

• the degree d(v ) of a vertex v ∈ V is the


number of edges v is adjacent to

• a path in a graph is a sequence


p = (v1 , v2 , . . . , vn ) of vertices such that
{vi , vi+1 } ∈ E for all i ∈ {1, 2, . . . , n}
Some definitions and terminology for graphs

5
Let G = (V , E ) be a graph. We define:
1
2
• a vertex v ∈ V is adjacent to edge
e ∈ E if v ∈ e 3

• the degree d(v ) of a vertex v ∈ V is the


number of edges v is adjacent to

• a path in a graph is a sequence


p = (v1 , v2 , . . . , vn ) of vertices such that
{vi , vi+1 } ∈ E for all i ∈ {1, 2, . . . , n}

• a simple path is a path in which no vertex


occurs more than once
Some definitions and terminology for graphs
4

Let G = (V , E ) be a graph. We 1
2
define:
3

• a subgraph G′of graph G is a a graph


G = (V , E ) with V ′ ⊆ V and E ′ ⊆ E
′ ′ ′
Some definitions and terminology for graphs
4

Let G = (V , E ) be a graph. We 1
2
define:
3

• a subgraph G′
of graph G is a a graph
G = (V , E ) with V ′ ⊆ V and E ′ ⊆ E
′ ′ ′

• graph G is connected, if for every two


distinct vertices v , v ′ ∈ V , there is a path
from v to v ′ (that is, a path which has v
as it’s first and v ′ as its last vertex)
Some definitions and terminology for graphs

Let G = (V , E ) be a graph. We 1
2
define:
3

• a cycle in a graph is a path for which the the first


and last vertex are identical
• a simple cycle in a graph is a cycle that contains
at least three different vertices and doesn’t
contain any vertex more than once (except for the
first and last)
Some definitions and terminology for graphs

Let G = (V , E ) be a graph. We 1
2
define:
3

• a cycle in a graph is a path for which the the first


and last vertex are identical
• a simple cycle in a graph is a cycle that contains
at least three different vertices and doesn’t
contain any vertex more than once (except for the
first and last)
• a tree is a graph that is connected and doesn’t
contain any simple cycles; vertices of degree one
in a tree are called leaves; sometimes we declare
one vertex in a tree to be special and call it a
root
Directed graphs

We illustrate directed graphs as points and connecting arrows:


4

1
2

A directed graph G = (V , E ) is formally defined as a pair of


• a set V of vertices
• and a set E of edges,
where each edge in E is a 2-tuple (or pair) of members of V .
Some definitions and terminology for directed graphs

• For an edge e = (v1 , v2 ) in a directed graph, we call e an


incoming edge to v2 and an outgoing edge for v1 .

• The in-degree din (v ) for a vertex v in a directed graph is the


number of its incoming edges. The out-degree dout (v ) is the
number of outgoing edges from v .

• A directed path in a directed graph is a sequence


p = (v1 , v2 , . . . , vn ) of vertices such that (vi , vi+1 ) ∈ E for all
i ∈ {1, 2, . . . , n}.

• A directed graph is strongly connected if every two distinct


vertices v and v ′ in V are connected by a directed path.
Alphabet, words, languages

An alphabet is a non-empty, finite set of symbols.


Examples:
• Σ = {0, 1}.
• Γ = {a, b, c, d, e, f , g , h, i, j, k, l, m, n, o, p, q, r , s, t, u, v , w , x, y , z}

A string or word over some alphabet Σ is a finite sequence of


symbols from Σ.
Examples:
• ruth
• 00101
Alphabet, words, languages

An alphabet is a non-empty, finite set of symbols.


Examples:
• Σ = {0, 1}.
• Γ = {a, b, c, d, e, f , g , h, i, j, k, l, m, n, o, p, q, r , s, t, u, v , w , x, y , z}

A string or word over some alphabet Σ is a finite sequence of


symbols from Σ.
Examples:
• ruth
• 00101

A language is a set of words (set of strings).


Some definitions and terminology for strings and languages

• the length of a string w is the number of symbols in w

• the empty string ϵ is a string of length 0 (that is, without any


symbols)

• the reverse wR of a string w is the number of symbols in w

• the concatenation of strings w = s1 s2 . . . sn and z = t1 t2 . . . tm


is the string wz = s1 s2 . . . sn t1 t2 . . . tm
Some definitions and terminology for strings and languages

• a substring z of string w is a consecutive subsequence of


symbols from w

• a prefix x of string w is a substring that starts at the first


position in w; that is, x is a prefix of w if there exists a string
z such that w = xz

• x is a proper prefix of w if x is a prefix of w and w ̸= x


Some definitions and terminology for strings and languages

• a substring z of string w is a consecutive subsequence of


symbols from w

• a prefix x of string w is a substring that starts at the first


position in w; that is, x is a prefix of w if there exists a string
z such that w = xz

• x is a proper prefix of w if x is a prefix of w and w ̸= x

• a prefix-free language over some alphabet Σ is a language


where no word in the language is a proper prefix of some
other word
Ordering words

Given an ordering of the symbols in some alphabet Σ, we can


define orderings of the set of words over Σ:
• Lexicographic order
Ordering words

Given an ordering of the symbols in some alphabet Σ, we can


define orderings of the set of words over Σ:
• Lexicographic order
Definition: We have w ≤lex z in lexicographic order for strings w = s1 s2 . . . sn
and z = t1 t2 . . . tm if w is a proper prefix of z or if there exists an index
j < min{n, m} such that si = ti for all i ∈ {1, 2, . . . j} and sj+1 < tj+1 .

• Short-lex order (or string order)


Definition: We have w ≤str z in string order for strings w = s1 s2 . . . sn and
z = t1 t2 . . . tm if w is shorter than z or if w and z have the same length and
w ≤lex z in lexicographic order.

You might also like