Cub11k's BIU Notes
Cub11k's BIU Notes
Assignments
Discrete-math
Discrete-math 1
Discrete-math 10
Discrete-math 11
Discrete-math 12
Discrete-math 2
Discrete-math 3
Discrete-math 4
Discrete-math 5
Discrete-math 6
Discrete-math 7
Discrete-math 8
Discrete-math 9
Infi-1
Infi-1 10
Infi-1 11
Infi-1 2
Infi-1 3
Infi-1 4
Infi-1 5
Infi-1 6
Infi-1 7
Infi-1 8
Infi-1 9
Linear-1
Linear-1 1
Linear-1 10
Linear-1 11
Linear-1 12
Linear-1 2
Linear-1 3
Linear-1 4
Linear-1 5
Linear-1 6
Linear-1 7
Linear-1 8
Linear-1 9
Linear-2
Linear-2 1
Lectures
Data-structures
Data-structures 1
Data-structures 2
Data-structures 3
Discrete-math
Discrete-math 10
Discrete-math 11
Discrete-math 12
Discrete-math 13
Discrete-math 14
Discrete-math 15
Discrete-math 16
Discrete-math 18
Discrete-math 19
Discrete-math 20
Discrete-math 21
Discrete-math 22
Discrete-math 23
Discrete-math 24
Discrete-math 25
Discrete-math 26
Discrete-math 3
Discrete-math 4
Discrete-math 5
Discrete-math 6
Discrete-math 7
Discrete-math 8
Discrete-math 9
Exam 2023 (2A)
Exam 2023 (2B)
Exam 2023 (A)
Exam 2023 (B)
Exam 2023 (C)
Exam 2024 (A)
Exam 2024 (B)
Exam 2024 (C)
Midterm
Infi-1
Exam 2022B (A)
Exam 2022B (B)
Exam 2023B (A)
Exam 2023B (B)
Exam 2024 (A)
Exam 2024 (B)
Exam 2025 (A)
Infi-1 10
Infi-1 12
Infi-1 13
Infi-1 14
Infi-1 15
Infi-1 16
Infi-1 17
Infi-1 19
Infi-1 20
Infi-1 21
Infi-1 22
Infi-1 23
Infi-1 24
Infi-1 25
Infi-1 26
Infi-1 5
Infi-1 6
Infi-1 7
Infi-1 9
Midterm
Theorems and proofs
Infi-2
Infi-2 1
Infi-2 10
Infi-2 11
Infi-2 12
Infi-2 13
Infi-2 14
Infi-2 15
Infi-2 16
Infi-2 17
Infi-2 2-3
Infi-2 3-4
Infi-2 5
Infi-2 6
Infi-2 7
Infi-2 8
Infi-2 9
Linear-1
Exam 2023 (B)
Exam 2023 (C)
Exam 2024 (A)
Exam 2024 (B)
Exam 2024 (C)
Exam 2025 (A)
Linear-1 11
Linear-1 12
Linear-1 13
Linear-1 4
Linear-1 5
Linear-1 6
Linear-1 7
Linear-1 8
Linear-1 9
Midterm
Random exams
Theorems and proofs
Linear-2
Linear-2 1
Linear-2 2
Linear-2 3
Linear-2 4
Linear-2 5
Linear-2 6
Linear-2 7
Linear-2 8
Seminars
CSI
CSI 2
Data-structures
Data-structures 1
Data-structures 2
Data-structures 3
Discrete-math
Discrete-math 1
Discrete-math 10
Discrete-math 11
Discrete-math 12
Discrete-math 2
Discrete-math 3
Discrete-math 4
Discrete-math 5
Discrete-math 6
Discrete-math 7
Discrete-math 8
Discrete-math 9
Infi-1
Infi-1 10
Infi-1 11
Infi-1 12
Infi-1 13
Infi-1 3
Infi-1 4
Infi-1 5
Infi-1 6
Infi-1 8
Infi-2
Infi-2 1
Infi-2 2
Infi-2 3
Infi-2 4
Infi-2 6
Infi-2 7
Infi-2 8
Linear-1
Linear-1 10
Linear-1 11
Linear-1 12
Linear-1 3
Linear-1 5
Linear-1 6
Linear-1 7
Linear-1 8
Linear-1 9
Linear-2
Linear-2 1
Linear-2 2
Linear-2 3
Linear-2 4
Linear-2 5
Linear-2 6
Linear-2 7
Templates
Lecture Template
Seminar Template
Home
Discrete-math 23
Discrete-math 23
Forest
#definition
Acyclic graph is called a forest
Tree
#definition
Connected acyclic graph is called a tree
Leaf
#definition
Vertex of degree
1
is called a leaf
Leaves of a tree
#lemma
Let
T
be a tree with
n
≥
2
vertices
Then
T
has at least two leaves
Proof:
Let
P
be the longest simple path in
T
T
has at least one edge
⟹
Length of this path is at least
1
P
=
(
v
0
,
v
1
,
…
,
v
k
)
,
v
0
≠
v
1
Suppose by contradiction
d
e
g
(
v
0
)
>
1
Then
v
0
has at least one more neighbor, let’s call it
v
′
T
has no cycles
⟹
v
′
is not in
P
⟹
(
v
′
,
v
0
,
…
,
v
k
)
is longer than
P
−
Contradiction!
The same can be done for
v
k
⟹
d
e
g
(
v
0
)
=
d
e
g
(
v
k
)
=
1
⟹
v
0
,
v
k
are leaves of
T
Paths between vertices
#lemma
Let
G
=
(
V
,
E
)
be a simple graph
Let
v
,
u
∈
V
Then there is a path from
v
to
u
iff there is a simple path from
v
to
u
Proof:
One direction is trivial, a simple path is a path and we are done
Let
∃
P
(
v
,
u
)
=
(
v
0
,
v
1
,
…
,
v
k
)
,
v
=
v
0
,
u
=
v
k
Let
w
appear twice in the path, e.g.
v
i
=
w
=
v
j
,
i
<
j
Then
∃
P
′
(
v
,
u
)
=
(
v
0
,
v
1
,
…
,
v
i
,
v
j
+
1
,
…
,
v
k
)
This process can be repeated until there are no repeating vertices in the path
Namely, until we get a simple path
Properties of the tree
#theorem
G
=
(
V
,
E
)
1.
G
is a tree
2.
G
is maximal acyclic graph
3.
∀
v
,
u
∈
V
:
∃
!
P
(
v
,
u
)
that is simple
4.
G
is a minimal connected graph
Prove:
1
⟺
2
⟺
3
⟺
4
Proof for
1
⟹
2
Let
G
be a tree
G
is connected
⟹
It has at least
n
−
1
edges
Adding an edge would make
m
≥
n
which means that
G
∪
{
e
}
will have a cycle
⟹
G
is a maximal acyclic graph
Proof for
2
⟹
3
Let
G
be a maximal acyclic graph
Let
v
,
u
∈
V
Suppose that there is no path between
v
and
u
Then adding edge
{
v
,
u
}
will not create a cycle
−
Contradiction!
⟹
∃
P
(
v
,
u
)
⟹
∃
P
(
v
,
u
)
that is simple
Suppose that there are two paths from
v
to
u
(
v
0
,
v
1
,
…
,
v
k
)
(
u
0
,
u
1
,
…
,
u
k
)
v
0
=
u
k
=
v
u
0
=
v
k
=
u
⟹
∃
P
(
v
,
v
)
:
(
v
0
,
v
1
,
…
,
v
k
,
u
1
,
…
,
u
k
)
which is a cycle
−
Contradiction!
⟹
∃
!
P
(
v
,
u
)
that is simple
Proof for
3
⟹
4
Let
∃
!
P
(
v
,
u
)
that is simple
⟹
G
is connected
Suppose
∃
{
v
,
u
}
∈
E
:
G
∖
{
{
v
,
u
}
}
is connected
⟹
∃
P
′
(
v
,
u
)
≠
P
(
v
,
u
)
⟹
∃
Two simple paths from
v
to
u
−
Contradiction!
⟹
G
is a minimal connected graph
Proof for
4
⟹
1
Let
G
be a minimal connected graph
⟹
G
is connected
Suppose
G
has a cycle
Removing any edge from this cycle would still leave
G
connected
−
Contradiction!
⟹
G
has no cycles
⟹
G
is a tree
1
⟹
2
⟹
3
⟹
4
⟹
1
⟹
1
⟺
2
⟺
3
⟺
4
Number of edges in a tree
#theorem
G
=
(
V
,
E
)
1.
G
is a tree
2.
G
is acyclic,
|
E
|
=
n
−
1
3.
G
is connected,
|
E
|
=
n
−
1
Prove:
1
⟺
2
⟺
3
Proof:
Let
G
be a tree
G
is a tree
⟹
G
is connected and acyclic
⟹
|
E
|
≥
n
−
1
If
|
E
|
≥
n
then
G
has a cycle
⟹
|
E
|
<
n
⟹
|
E
|
=
n
−
1
⟹
1
⟹
2
,
1
⟹
3
Let
G
be connected
,
|
E
|
=
n
−
1
Removing any edge will make the graph disconnected
⟹
G
is a minimal connected graph
⟹
G
is a tree
⟹
3
⟹
1
Let
G
be acyclic
,
|
E
|
=
n
−
1
Suppose
G
is not connected
⟹
# of components is at least
2
Let
G
v
,
G
u
be two connected components of
G
⟹
There is no path from
v
to
u
⟹
Adding edge
{
v
,
u
}
will make number of edges equal to
n
and not create a cycle
⟹
G
∪
{
{
v
,
u
}
}
has no cycle
−
Contradiction!
⟹
G
is connected
⟹
G
is a tree
⟹
2
⟹
1
1
⟺
2
∧
2
⟺
3
⟹
1
⟺
2
⟺
3