Download as pdf or txt
Download as pdf or txt
You are on page 1of 188

Discrete Structures

Discrete Structures

Dr. Ferit Toska

May 19, 2022

Dr. Ferit Toska Discrete Structures


Discrete Structures
Course Information

CENG 110 - Discrete Structures


Thursday 1-2 pm
Online
ferit.toska@okan.edu.tr, toskaf@gmail.com

Dr. Ferit Toska Discrete Structures


Discrete Structures
Content

Textbook

We will use the following textbook:


Discrete Mathematics and Its Applications by Kenneth H.
Rosen, Eight Edition, McGraw-Hill, 2019.
The following resources are supplementary:
A Course in Discrete Structures by Rafael Pass, Wei-Lung,
Dustin Tseng
Applied Discrete Structures, Al Doerr, Ken Levasseur

Dr. Ferit Toska Discrete Structures


Discrete Structures
Content

Topics - Chapters

We will cover selected sections from the following chapters:


1 Logic
2 Sets and Functions
3 Algorithms
4 Number Theory

Dr. Ferit Toska Discrete Structures


Discrete Structures
Content

Outline

5 Induction and Recursion


6 Counting
7 Relations
8 Graphs
9 Trees

Dr. Ferit Toska Discrete Structures


Discrete Structures
Content

Exams and Grading

Midterm: 40% (week of 4-9 April)


Final: 60% (May 23 - June 3)
Participation: 10%
Refer to Okan University academic calendar for important dates.
Make-up policy: Make-up exams are subject to departmental
approval. In case of missing an exam, you need to follow
departmental procedures.

Dr. Ferit Toska Discrete Structures


Discrete Structures
Content

Grading Scale

AA 91 - 110
BA 86 - 90
BB 81 - 85
CB 76 - 80
CC 71 - 75
DC 66 - 70
DD 61 - 65
FD 51 - 60
FF 0 - 50

Note: Grading scale is subject to change.

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 1: Propositional Logic

WEEK 1
Propositional Logic

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 1: Propositional Logic

Definitions

Proposition: A declarative sentence that is either true or


false, but not both.
Propositional Variables: Letters, P, Q, R, S, ... to denote
propositions.
Truth Value: The truth value of a proposition is true, if it is
a true proposition, denoted by T. The truth value of a
proposition is false, if it is a false proposition, denoted by F.
Atomic Propositions: A proposition that cannot be
expressed in terms of simpler propositions.

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 1: Propositional Logic

Examples

Raise your hand if this sentence is a proposition.


2+2=4
Istanbul is the capital of Turkey.
x +2=5
Today is not the first day of the spring semester.

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 1: Propositional Logic

Logical Operators

Compound propositions are formed from existing


propositions using logical operators.
Let P and Q be propositions.
Negation: The negation of P, denoted by ¬P is, is the
(compound) proposition “It is not the case that P”
Conjunction: The conjunction of P and Q, denoted by
P ∧ Q, is the proposition “P and Q.”
Disjunction: The disjunction of P and Q, denoted by P ∨ Q,
is the proposition “P or Q.”
Conditional Statement: The conditional statement P → Q
is the proposition “if P then Q.”
Biconditional Statement: The conditional statement
P ↔ Q is the proposition “P if and only if Q.”

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 1: Propositional Logic

Examples

P: Today is the first day of the spring semester.


¬P: Today is not the first day of the spring semester.
2 is an even number and 2 is a prime number.
Rebecca’s PC has at least 16 GB free disk space, or the
processor in Rebecca’s PC runs faster than 1 GHz.
If you get 100% from the final, then you will get an A.
You will get an A if and only if you get 100% from the final.

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 1: Propositional Logic

Truth Table: Negation

P ¬P
T F
F T

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 1: Propositional Logic

Truth Table: Conjunction

P Q P ∧Q
T T T
T F F
F T F
F F F

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 1: Propositional Logic

Truth Table: Disjunction

P Q P ∨Q
T T T
T F T
F T T
F F F

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 1: Propositional Logic

Truth Table: Conditional

P Q P→Q
T T T
T F F
F T T
F F T

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 1: Propositional Logic

Truth Table: Biconditional

P Q P↔Q
T T T
T F F
F T F
F F T

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 1: Propositional Logic

Biconditional vs Conjunction of Conditionals

P Q P↔Q P→Q Q→P P →Q ∧Q →P


T T T T T T
T F F F T F
F T F T F F
F F T T T T

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 2: Logic Part II

WEEK 2
Logic Part II

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 2: Logic Part II

Definitions

Tautology is a proposition that is always true.


Contradiction is a proposition that is always false.
Contingency is a proposition that is neither a tautology nor a
contradiction.
Logical Equivalency: Two propositions P and Q are called
logically equivalent if P ↔ Q is a tautology.

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 2: Logic Part II

Logical Equivalences

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 2: Logic Part II

Logical Equivalences

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 2: Logic Part II

Logical Equivalences

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 2: Logic Part II

Logical Equivalences

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 2: Logic Part II

Example

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 2: Logic Part II

Example: Distributive Law


Build a truth table to show that P ∨ (Q ∧ R) is equivalent to
(P ∨ Q) ∧ (P ∨ R)

P Q R Q ∧R P ∨ (Q ∧ R) P ∨Q P ∨R (P ∨ Q) ∧ (P ∨ R)
T T T T T T T T
T T F F T T T T
T F T F T T T T
T F F F T T T T
F T T T T T T T
F T F F F T F F
F F T F F F T F
F F F F F F F F

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 2: Logic Part II

Satisfiability

A compound proposition is satisfiable if it is a tautology or a


contingency.
Example: (P ∨ ¬Q) ∧ (Q ∨ ¬R) ∧ (R ∨ ¬P)
the n-Queens Problem
Sudoku

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 2: Logic Part II

n-Queens

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 2: Logic Part II
Predicates and Quantifiers

Predicate

Example: x is a prime number


Predicate: The second part “is a prime number” is predicate.
It attributes a property to its subject.
Propositional function P(x): x is prime number.
A propositional function becomes a proposition once we
assign a value.
P(4), P(5)

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 2: Logic Part II
Predicates and Quantifiers

Universal Quantifier

Definition:The universal quantification of P(x) is the


statement “P(x) for all values of x in the domain”
Notation: ∀xP(x)
Example: Let P(x) be the statement “2x is even”. Is ∀xPx
true?

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 2: Logic Part II
Predicates and Quantifiers

Existential Quantifier

Definition:The existential quantification of P(x) is the


statement “There exists an element x in the domain such that
P(x)”
Notation: ∃xP(x)
Example: Let P(x) be the statement “2x = 0”. Is ∃xP(x)
true?

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 2: Logic Part II
Predicates and Quantifiers

Quantifiers over Finite Domains

Let the domain of discourse be {−1, 0, 1, 2}.


Let P(x) be the statement “|x| < 2”.
Let Q(x) be the statement “|x| < 3”.
∀P(x): P(−1) ∧ P(0) ∧ P(1) ∧ P(2)
∃Q(x): Q(−1) ∨ Q(0) ∨ Q(1) ∨ Q(2)
∀xP(x) is False.
∃xQ(x) is True.

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 2: Logic Part II
Predicates and Quantifiers

Negating Quantified Expressions

¬∀xP(x) ≡ ∃x¬P(x)
¬∃xP(x) ≡ ∀x¬P(x)
Previous example: Let P(x) be the statement “|x| < 2”.
P(2) is False.
¬P(2) is True.
∃x¬P(x) is True.
¬∀xP(x) is True.
∀xP(x) is False.

Dr. Ferit Toska Discrete Structures


Discrete Structures
Rules of Inference

Definitions

An argument is a sequence of statements.


The last statement of an argument is called conclusion.
The preceding statements are called premises of the
argument.
A valid argument is an argument where the conclusion must
be true if all the premises are true.
A sound argument is a valid argument where all of the
premises are true.

Dr. Ferit Toska Discrete Structures


Discrete Structures
Rules of Inference

Modus Ponens

P
P→Q
∴Q
This is equivalent of saying
(P ∧ (P → Q)) → Q

Dr. Ferit Toska Discrete Structures


Discrete Structures
Rules of Inference

Rules of Inference

Dr. Ferit Toska Discrete Structures


Discrete Structures
Rules of Inference

Rules of Inference

Dr. Ferit Toska Discrete Structures


Discrete Structures
Rules of Inference

Rules of Inference

Dr. Ferit Toska Discrete Structures


Discrete Structures
Rules of Inference

Example 6

Step Reason
(1) ¬P ∧ Q Premise
(2) R→P Premise
(3) ¬R → S Premise
(4) S →T Premise
(5) ¬P (1) simplification
(6) ¬R (5) and (2) modus tollens
(7) S (6) and (3) modus ponens
(8) T (7) and (4) modus ponens

Dr. Ferit Toska Discrete Structures


Discrete Structures
Rules of Inference

Example 13

Step Reason
(1) ∃x(C (x) ∧ ¬B(x)) Premise
(2) ∀x(C (x) → P(x)) Premise
(3) C (a) ∧ ¬B(a) Existensial instantiation from (1)
(4) C (a) Simplification from (3)
(5) C (a) → P(a) Universal instantiation from (2)
(6) P(a) (5) and (4) modus ponens
(7) ¬B(a) Simplification from (3)
(8) P(a) ∧ ¬B(a) (7) and (6) conjunction
(9) ∃x(P(x) ∧ ¬B(x)) Existential generalization from (8)

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 3: Set Theory

WEEK 3
Set Theory

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 3: Set Theory

Definition
A set is an unordered collection of distinct objects, called elements
or members of the set.

Notation
a ∈ A: a is an element of the set A.
a∈
/ A: a is not an element of the set A.

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 3: Set Theory

Examples

The set O of all odd positive integers less than 10

O = {1, 3, 5, 7, 9} = {x ∈ Z+ | x is odd and x < 10}

Empty set { } or ∅
Singleton set {’a set with one element’}
Venn diagram

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 3: Set Theory

Definition (A = B)
Two sets A and B are equal if they have the same elements. That
is,
∀x(x ∈ A ↔ x ∈ B)

Definition (A ⊆ B)
The set A is a subset of B if every element of A is also an element
of B. That is,

A ⊆ B ⇐⇒ ∀x(x ∈ A → x ∈ B)

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 3: Set Theory

Example of a theorem and its proof

Theorem
Two sets A and B are equal if and only if A is a subset of B and B
is a subset of A. That is,

A = B ⇐⇒ A ⊆ B and B ⊆ A

Proof.
The proof has two parts:
(⇒) : A = B implies A ⊆ B and B ⊆ A
(⇐) : A ⊆ B and B ⊆ A implies A = B

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 3: Set Theory

Proof: first part

Assume that A = B.
First, we want to show that A ⊆ B. That is,
∀x(x ∈ A → x ∈ B)
Let x ∈ A be arbitrary.
Since A = B, that is ∀x(x ∈ A ↔ x ∈ B), we have
x ∈ A ↔ x ∈ B (by universal instantiation).
This implies that x ∈ A → x ∈ B.
Since x ∈ A, we get x ∈ B (by modus ponens).
Since x was an arbitrary element of A, we conclude that
A ⊆ B by universal generalization.
Next, we need to show that B ⊆ A. This part is similar to the
proof of A ⊆ B.
Dr. Ferit Toska Discrete Structures
Discrete Structures
Week 3: Set Theory

Proof: second part

Assume that A ⊆ B and B ⊆ A.


We need to show that A = B.
So, we need to show that ∀x(x ∈ A ↔ x ∈ B).
Let x be arbitrary.
First assume that x ∈ A and show x ∈ B.
Since A ⊆ B, x ∈ B follows by the definition of subset.
Thus, x ∈ A → x ∈ B.
Similarly, we can show that x ∈ B → x ∈ A.
Since x was arbitrary, ∀x(x ∈ A ↔ x ∈ B) follows.
Hence, by the first and second parts we have proven the theorem.

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 3: Set Theory

Cardinality and Power set

Definition (Cardinality)
Let S be a set. If there are exactly n distinct elements of S for
some n ∈ N, we say that S is a finite set with the cardinality n.
The cardinality of S is denoted by |S|
A set is said to be infinite if it is not finite.

Definition (Power set)


Let S be a set. The power set of S, denoted by P(S), is the set
of all subsets of S.

P(S) = {A | A ⊂ S}

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 3: Set Theory

Examples

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 3: Set Theory

More Definitions

Definition
Cartesian Product: A × B = {(a, b) | a ∈ A and b ∈ B}
Union: A ∪ B = {x | (x ∈ A) ∨ (x ∈ B)}
Intersection: A ∩ B = {x | (x ∈ A) ∧ (x ∈ B)}
Difference: A − B = {x | (x ∈ A) ∧ (x ∈
/ B)}
Complement: Ā = {x ∈ U | x ∈
/ A} where U is the universal
set.

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 3: Set Theory

Examples

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 3: Set Theory

Set Identities

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 3: Set Theory

Examples

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 3: Set Theory

Set Identities

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 3: Set Theory

Examples

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 3: Set Theory

Representation of subsets of Natural Numbers

Any subset of natural numbers can be represented with an infinite


string of 0’s and 1’s.
∅ = 00000....
N = 11111...
{1, 5, 8} = 010001001000000...
{n ∈ N | n is even } = 1010101010...
{n ∈ N | n is a prime number} = 0011010100010100....
A = n0 n1 n2 ... where ni = 1 if i ∈ A and ni = 0 if i ∈
/ A.

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 4

WEEK 4
Functions

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 4

Relations
Definition
Let A and B be sets. A relation R is a subset of A × B.

Example
Let A = {Istanbul,Ankara,Izmir, Adana} and
B = {London, Berlin, Athens}. Then,
F = {(Ist,Lon),(Ist,Ber),(Ist,Ath),(Ank,Ber),(Ank,Ath),(Izm,Ber)}
is a relation.
London Berlin Athens
Istanbul x x x
Ankara x x
Izmir x
Adana
Dr. Ferit Toska Discrete Structures
Discrete Structures
Week 4

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 4

Functions

Definition
Let f be a relation from A to B. Then,
f is said to be a function if for all x ∈ A there exists a unique
y ∈ B such that (x, y ) ∈ f . In other words,
if (x, y1 ), (x, y2 ) ∈ f , then y1 = y2 .
If (x, y ) ∈ f , we write f (x) = y and say that y is the image
of x and x is a preimage of x.
A is called the domain of f .
B is called the codomain of f .
The range of f is the set of all images of elements of A.

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 4

Example
Let f : Z −→ Z be a function that maps each integer to its
square. That is, f (x) = x 2 . Then,
The domain of f is the set of integers.
The codomain of f is the set of integers.
The range of f is the set of perfect squares {0, 1, 4, 9, 16, ...}.

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 4

Mouse dataset

By Chire - Own work, Public Domain,


https://commons.wikimedia.org/w/index.php?curid=11765684

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 4

Injection, Surjection, Bijection

Definition
Let f be a function from A to B. Then,
f is said to be one-to-one, or an injection, if
∀a1 ∀a2 (f (a1 ) = f (a2 ) → a1 = a2 ) or equivalently
∀a1 ∀a2 (a1 6= a2 → f (a1 ) 6= f (a2 )).
f is said to be onto, or a surjection if
(∀b ∈ B)(∃a ∈ A)(f (a) = b)
f is called a bijection if f is both one-to-one and onto.

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 4

Example: Lazy Copying Machine

Let f : {0, 1}∗ −→ {0, 1}∗ be a function that maps each string
u = abc where |a| = |b| = |c| to a. That is, f (u) = a. Then,
The domain of f :
The codomain of f :
The range of f :
Is f an injection, surjection,bijection?

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 4

Inverse functions

Definition
Let f be a function from A to B. Then, If f is a bijection, then the
inverse function of f is a function, denoted by f −1 , such that

f −1 (b) = a

when f (a) = b.

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 4

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 4

Compositions of functions

Definition
Let g be a function from A to B and f be a function from B to C .
Then, the composition of the functions f and g , denoted by
f ◦ g , is the function from A to C defined by

(f ◦ g )(a) = f (g (a))

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 4

(Game of life: https://playgameoflife.com/)


f : {1, . . . , 9} −→ {1, . . . , 9} defined on the grid with the rules:
Move right; if not possible move up; if not possible move left, if
not possible move down.
“itinerary” of x:

7 8 9

4 5 6

1 2 3

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 4

Sequences

Definition
A sequence is a function from a subset of integers to a set S. We
use the notation an to denote the image of the integer n. We call
an a term of the sequence.

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 4

Examples

1
an = n
bn = 2 · 3n
cn = 7 + 2 · n
dn = 5 + (−1)n · dn−1 and d0 = 1 (range of this function?)
Fibonacci sequence
Ackermann function

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 4

more examples

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 4

Recurrence

Definition
A recurrence relation for the sequence {an } is an equation that
expresses an in terms of one or more of the previous terms of the
sequence.

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 4

Summation

Consider a finitely many terms of a sequence am , am+1 , ..., an . We


use the notation
Xn
aj
j=m

to denote the sum am + am+1 + ... + an .

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 4

more examples

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 5: Algorithms

WEEK 5-6
Algorithms

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 5: Algorithms

Algorithm

Definition (Algorithm)
An algorithm is a finite sequence of instructions for performing a
computation or for solving a problem.

Example
Define an algorithm for finding the largest apple in a basket.

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 5: Algorithms

Properties of Algorithms

Input
Output
Definiteness
Correctness
Finiteness
Effectiveness
Generality

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 5: Algorithms

Example

Input A basket of apples.


Output The largest apple in the basket.
Definiteness Each step in the algorithm is precisely defined.
Correctness All apples are compared (how?) and the largest
one is found.
Finiteness At most finitely many comparisons were
performed.
Effectiveness Each step requires finite amount of time.
Generality Given a basket of apples (different size, shape and
number) we can follow the same instructions to find the
largest one.

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 5: Algorithms

https://www.youtube.com/watch?v=cDA3_5982h8

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 5: Algorithms

Searching Algorithms

9 17 6 52 4 25 8 23
The Linear Search
The Binary Search
4 6 8 9 17 23 25 52

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 5: Algorithms

Sorting Algorithms

The Bubble Sort:


https://www.youtube.com/watch?v=semGJAJ7i74
The Insertion Sort:
https://www.youtube.com/watch?v=EdIKIf9mHk0

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 5: Algorithms

A nice animation:
https://www.youtube.com/watch?v=kPRA0W1kECg
There are many nice facts on sorting algorithms. Visit Wikipedia!
Post on the discussion board!

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 5: Algorithms

Read the following topics (from the textbook):


Greedy algorithms
Halting problem
Post questions, comments, interesting facts on the discussion
board.

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 5: Algorithms

Growth of Functions

Definition (Big-O)
Let f and g be functions from the set of integers or the set of real
numbers to the set of real numbers. We say that f (x) is O(g (x))
if there are constants C and k such that |f (x)| ≤ C |g (x)|
whenever x > k.

Informally, the definition says f (x) grows slower than g (x).


If you can find a pair of constants C and k, you can find
infinitely of them.

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 5: Algorithms

Example
Let f (x) = x 2 + 5x + 3. Then, f (x) is O(x 2 ).

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 5: Algorithms

Example
Let f (x) = x 2 + 5x + 3. Then, f (x) is O(x 2 ).

We need to find a pair of witnesses C and k. For all x > 1


(implies x 2 > x > 1)
0 ≤ x 2 + 5x + 3 ≤ x 2 + 5x 2 + 3x 2 = 9x 2
=⇒ |f (x)| < 9|x 2 | for all x > 1.
We have witnesses C = 9 and k = 1.
f (x) is also O(x n ) for any n ≥ 2.
f (x) is not O(x).

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 5: Algorithms

Example: Growth of Functions

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 5: Algorithms

Big-Omega

Definition
Let f and g be functions from the set of integers or the set of real
numbers to the set of real numbers. We say that f (x) is Ω(g (x))
if there are constants C > 0 and k such that |f (x)| ≥ C |g (x)|
whenever x > k.

f (x) is Ω(g (x)) if and only if g (x) is O(f (x)).

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 5: Algorithms

Big-Theta

Definition
Let f and g be functions from the set of integers or the set of real
numbers to the set of real numbers. We say that f (x) is Θ(g (x))
if f (x) is O(g (x)) and f (x) is Ω(g (x)).
In that case, we say that f (x) and g (x) are of the same order.

f (x) is of Θ(g (x)) if and only if g (x) is of Θ(f (x))

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 5: Algorithms
Complexity of Algorithms

Introduction

How can we analyze the efficiency of algorithms?


Computational Complexity
Time Complexity
Space Complexity

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 5: Algorithms
Complexity of Algorithms

Introduction - Time Complexity

an analysis for time required to solve a problem


not measuring the actual time
counting the number of operations involved
express this count relative to the size of the input

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 5: Algorithms
Complexity of Algorithms

Example

Consider the example we had about finding the maximum element


in a list of integers.
Input size is n, the length of the input a1 , a2 , ..., an .
assign the max value to a1 (1 operation)
compare max value to a2 (2nd operation)
assign the larger value of the the max value (3rd operation)
do the last two steps n − 1 times in total (2(n − 1) operations)
In total we get 1 + 2(n − 1) = 2n − 1 operations.

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 5: Algorithms
Complexity of Algorithms

Linear Search

Input: list of integers of length n and another integer M to be


searched
Compare a1 and M
worst case: compare M and all an
takes “roughly” n steps
Θ(n)

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 5: Algorithms
Complexity of Algorithms

Worst Case
Analyze the binary search algorithm.
Assume that the input size is n = 2k and x is searched.
Worst case: The algorithm runs “all the way” and exits
without finding x.
1 Is there a middle element am ?
2 Compare x and am
3 Update the end points
Repeat steps 1-3 until there is no middle point.
Each time we reduce the length of the list to its half.
2k , 2k−1 , ..., 21 , 20 .
That is k = log 2k = logn repeats.
worst case Θ(logn) time complexity.
Dr. Ferit Toska Discrete Structures
Discrete Structures
Week 5: Algorithms
Complexity of Algorithms

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 5: Algorithms
Complexity of Algorithms

important notions

brute-force algorithms
greedy algorithms
polynomial complexity
tractable & intractable problems
class NP: non-deterministic polynomial time
NP-complete problems
decidable (solvable) & undecidable problems

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 5: Algorithms
Complexity of Algorithms

Example: Growth of Functions

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 5: Algorithms
Complexity of Algorithms

Common Complexity Notions

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 5: Algorithms
Complexity of Algorithms

Example

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 7: Number Theory

WEEK 7
Number Theory

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 7: Number Theory
Modular Arithmetic

Division

Definition
Let a, b ∈ Z. We say that a divides b, denoted by a | b if
(∃m ∈ Z)(a · m = b).

Example
Let n ∈ Z. List the positive integers d such that d | n.
n = 2: {1, 2}
n = 6: {1, 2, 3, 6}
n = 7: {1, 7}
n = 12: {1, 2, 3, 4, 6, 12}

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 7: Number Theory
Modular Arithmetic

Theorem
Let a, b, c ∈ Z such that a 6= 0. Then,
(i) if a | b and a | c, then a | (b + c)
(ii) if a | b, then a | m · b for all m ∈ Z
(iii) if a | b and b | c, then a | c.

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 7: Number Theory
Modular Arithmetic

Proof

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 7: Number Theory
Modular Arithmetic

Corollary
If a, b, c ∈ Z where a 6= 0, such that a | b and a | c, then for all
m, n ∈ Z, a | (mb + nc).

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 7: Number Theory
Modular Arithmetic

Theorem (The Division Algorithm)


Let a be an integer and d a positive integer. Then there are unique
integers q and r , with 0 ≤ r < d such that a = d · q + r .

d: divisor
a: dividend
q: quotient
r : remainder

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 7: Number Theory
Modular Arithmetic

Modular Arithmetic

Definition
If a, b, m ∈ Z where m > 0, then a is congruent to b modulo m
if m | (a − b). We write a ≡ b (mod m).

Theorem
a ≡ b (mod m) if and only if the remainder from the division of a
to m, and the remainder from the division of b to m are equal.

Theorem
a ≡ b (mod m) if and only if ∃k ∈ Z such that a = b + km

Dr. Ferit Toska Discrete Structures


Discrete Structures
Representations of Integers

Representations of Integers
Theorem
Let b, n ∈ N where b > 1. Then n can be expressed uniquely in the
form
n = ak b k + ak−1 b k−1 + ... + a1 b + a0
where k is nonnegative integer, a0 , a1 , ..., ak are nonnegative
integers less than b, and ak 6= 0.

Example (Binary Expansion)

(101101)2 = 1 · 25 + 0 · 24 + 1 · 23 + 1 · 22 + 0 · 21 + 1 · 20

= 32 + 8 + 4 + 1 = 45
Dr. Ferit Toska Discrete Structures
Discrete Structures
Representations of Integers
Prime Numbers

Prime Numbers

Definition
An integer p greater than 1 is called prime if the only positive
factors of p are 1 and p. A positive integer that is greater than 1
and is not prime is called composite.

Theorem (THE FUNDAMENTAL THEOREM OF ARITHMETIC)


Every integer greater than 1 can be written uniquely as a prime or
as the product of two or more primes.

Example
198 = 2 · 3 · 3 · 11

Dr. Ferit Toska Discrete Structures


Discrete Structures
Representations of Integers
Prime Numbers

Theorem
If n is a composite integer, then n has a prime divisor less than or

equal to n.

Dr. Ferit Toska Discrete Structures


Discrete Structures
Representations of Integers
Prime Numbers

Example (Trial Division)


Find the prime factorization of 2235.

Dr. Ferit Toska Discrete Structures


Discrete Structures
Representations of Integers
Prime Numbers

The Sieve of Eratosthenes

Dr. Ferit Toska Discrete Structures


Discrete Structures
Representations of Integers
Prime Numbers

Theorem
There are infinitely many primes.

Dr. Ferit Toska Discrete Structures


Discrete Structures
Representations of Integers
Prime Numbers

Example (Mersenne primes)


There are primes of the form 2p − 1 where p is a prime number.
The largest Mersenne prime found is 282,589,933 − 1, having
24,862,048 digits.

Example (Goldbach’s Conjecture)


Every even number greater than 2 is the sum of two prime
numbers.

Example (The Twin Prime Conjecture)


There are infinitely many primes that differ by 2 (pairs of primes of
the form p and p + 2). For example, p = 3, 5, 11, 17.

Dr. Ferit Toska Discrete Structures


Discrete Structures
Representations of Integers
Prime Numbers

Definition (gcd)
Let a, b be non-zero integers. The largest integer d such that d | a
and d | b is called the greatest common divisor of a and b, and
denoted by gcd(a, b).

Example
Find gcd(60, 210)
divisors of 60: A = {1, 2, 3, 4, 5, 6, 10, 12, 15, 20, 30, 60}
divisors of 210:
B = {1, 2, 3, 5, 6, 7, 10, 14, 15, 21, 30, 35, 42, 70, 105, 210}
max(A ∩ B) = 30.

Dr. Ferit Toska Discrete Structures


Discrete Structures
Representations of Integers
Prime Numbers

Definition
The integers a and b are relatively prime if gcd(a, b) = 1.

Definition (lcm)
The least common multiple of two positive integers a and b is
the smallest positive integer that is divisible by both a and b, and
denoted by lcm(a, b).

Theorem
Let a be b be positive integers. Then ab = gcd(a, b) · lcm(a, b)

Dr. Ferit Toska Discrete Structures


Discrete Structures
Representations of Integers
Prime Numbers

The Euclidean Algorithm

Find gcd(216, 150).


216 = 150 · 1 + 66
150 = 66 · 2 + 18
66 = 18 · 3 + 12
18 = 12 · 1 + 6
12 = 6 · 2 + 0

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 8

Week 8:
Induction and Recursion

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 8

Peano Axioms

Robinson Arithmetic
1 ∀x (0 6= S(x))
2 ∀x, y (S(x) = S(y ) → x = y )
3 ∀x (x + 0 = x)
4 ∀x, y (x + S(y ) = S(x + y ))
5 ∀x (x · 0 = 0)
6 ∀x, y (x · S(y ) = x · y + x)
+ Mathematical Induction
7 For any propositional function P(n) (in the language of
arithmetic)
(P(0) ∧ ∀k (P(k) → P(k + 1))) → ∀n P(n)

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 8

Examples

n(n+1)
1 + 2 + ... + n = 2
1 + 2 + 22 + ... + 2n = 2n+1 −1
2n < n!, for all n ≥ 4

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 8

Mistaken Proofs

Every set of lines in the plane, no two of them are parallel, meet in
a common point.

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 8

Strong Induction

To show that P(n) is true for all n ∈ N, complete


Basis Step: P(0) is true
Inductive Step: (P(0) ∧ P(1) ∧ ... ∧ P(k)) → P(k + 1)

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 8

Example

Show that if n is an integer greater than 1, then n can be written


as the product of primes.

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 8

Well Ordering Property

Every nonempty set of nonnegative integers has a least element.


Example
Division Algorithm: If a, d ∈ Z where d > 0, then there are
unique integers q and r with 0 ≤ r < d and a = dq + r .

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 8

Recursively Defined Functions

To define a function on N recursively


Define f (0) = y0
Define a rule R such that for k > 0, f (k) = y where
R(0, 1, ..., k − 1) = y

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 8

example

Give a recursive definition for an where a ∈ R such that a 6= 0 and


n ∈ N.

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 8

Recursively defined Sets

Definition
The set {0, 1}∗ of strings is defined recursively by
λ ∈ {0, 1}∗ where λ is the empty string.
If w ∈ {0, 1}∗ and a ∈ {0, 1}, then wa ∈ {0, 1}∗ .

Example
Let u ∈ {0, 1}∗ be fixed. Then u ∗ is defined recursively by
u ∈ u∗
If w ∈ u ∗ , then wu ∈ u ∗

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 8

Recursively Defined Algorithms

Example
A recursive algorithm for gcd(a, b) where 0 ≤ a < b:
if a = 0 then return b
else
find q, r such that b = a · q + r where 0 ≤ r < a
return gcd(r , a)

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 9

Week 9:
Counting
Relations

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 9

Product Rule

Suppose that a procedure can be broken down into a sequence of


two tasks. If there are n1 ways to the first task and for each of
these ways of doing the first task, there are n2 ways to do the
second task, then there are n1 n2 ways to do the procedure.
Example (p.417, pr.4)
A particular brand of shirt comes in 12 colors, has a male version
and a female version, and comes in three sizes for each sex. How
many different types of this shirt are made?

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 9

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 9

Sum Rule

If a task can be done either in one of n1 ways or in one of n2 ways,


where none of the set of n1 ways is the same as the set of n2 ways,
then there are n1 + n2 ways to the task.

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 9

Subtraction Rule

If task can be done in either n1 ways or n2 ways, then the number


of ways to the task is n1 + n2 minus the number of ways to the
task that are common to two different ways.

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 9

Example (p.417 pr.22)


How many positive integers less than 1000 are divisible by 7 but
not by 11?

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 9

Division Rule

A task can be done in n/d distinct ways, if it can be done in n


ways, but for each way of doing the task, there are d equivalent
ways of doing it.
Example (p.418 pr.47)
How many ways are there to seat six people around a circular table
where two seatings are considered the same when everyone has the
same two neighbors without regard to whether they are right or
left neighbors?

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 9

Pigeonhole Principle

If k is a positive integer and k + 1 or more objects are placed


into k boxes, then there is at least one box containing two or
more of the objects.
If N objects are placed into k boxes, then there is at least one
box containing at least dN/ke objects.

Example (p.427, pr.27)


There are 38 different time periods during which classes at a
university can be scheduled. If there are 677 different classes, how
many different rooms will be needed?

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 9

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 9

Relations
Definition
Let A and B be sets. A relation R is a subset of A × B.

Example
Let A = {Istanbul,Ankara,Izmir, Adana} and
B = {London, Berlin, Athens}. Then,
F = {(Ist,Lon),(Ist,Ber),(Ist,Ath),(Ank,Ber),(Ank,Ath),(Izm,Ber)}
is a relation.
London Berlin Athens
Istanbul x x x
Ankara x x
Izmir x
Adana
Dr. Ferit Toska Discrete Structures
Discrete Structures
Week 9

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 9

Properties of Relations

A relation R on a set A is called


reflexive if (a, a) ∈ R for every element a ∈ A.
symmetric if (b, a) ∈ R whenever (a, b) ∈ R, for all a, b ∈ A.
transitive if whenever (a, b) ∈ R and (b, c) ∈ R, then
(a, c) ∈ R for all a, b, c ∈ A.
antisymmetric if (a, b) ∈ R and (b, a) ∈ R implies a = b, for
all a, b ∈ A.

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 9

p.608 pr.3

For each of these relations on the set {1, 2, 3, 4}, decide whether it
is reflexive, whether it is symmetric, whether it is antisymmetric,
and whether it is transitive.
a) {(2, 2), (2, 3), (2, 4), (3, 2), (3, 3), (3, 4)}
b) {(1, 1), (1, 2), (2, 1), (2, 2), (3, 3), (4, 4)}
c) {(2, 4), (4, 2)}
d) {(1, 2), (2, 3), (3, 4)}
e) {(1, 1), (2, 2), (3, 3), (4, 4)}
f) {(1, 3), (1, 4), (2, 3), (2, 4), (3, 1), (3, 4)]}

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 9

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 9

Equivalence Relation

Definition
A relation on a set A is called an equivalence relation if it is
reflexive, symmetric, and transitive.

Definition
Let R be an equivalence relation on a set A. The set of all
elements that are related to an element a of A is called the
equivalence class of a, denoted by [a]R .
[a]R = {x ∈ A : (a, x) ∈ R}

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 9

Example
What are the equivalence classes of congruence modulo 3?
[0] = {
[1] = {
[2] = {

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 9

Theorem
Let R be an equivalence relation on a set A. These statements for
elements a and b of A are equivalent:
(i) aRb
(ii) [a] = [b]
(iii) [a] ∩ [b] 6= ∅

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 9

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 9

Order Relations

Definition
A relation R on a set S is called a partial order if it is reflexive,
antisymmetric, and transitive.

Example
(Z, ≤)
(P(A), ⊂)
(Z+ , a|b)

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 9

Definition
The elements a and b of a poset (S, ) are called comparable if
either a  b or b  a.

Definition
If (S, ) is a poset and every two elements of S are comparable, S
is called a totally ordered or linearly ordered set, and  is called
a total order or a linear order.

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 10

Week 10:
Graph Theory

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 10

Examples

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 10

Examples

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 10

Examples

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 10

Examples

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 10

Examples

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 10

Graph Terminology

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 10

Definitions

A graph G = (V , E ) consists of V , a nonempty set of


vertices and a set of edges E ⊂ {{u, v } | u, v ∈ V }
Two vertices u and v are adjacent if {u, v } ∈ E .
For v ∈ V , the neighborhood of v , denoted by N(v ) is
{u ∈ V | {u, v } ∈ E }.
The degree of a vertex v is the cardinality of N(v ) and
denoted by deg (v ).

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 10

Simple Results

Let G = (V , E ) be a graph with m edges. Then,


X
2m = deg (v )
v ∈V

An (undirected) graph has an even number of vertices of odd


degree.

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 10

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 10

Examples: Special Graphs

Complete Graphs: K1 , K2 , ...


Cycles: C3 , C4 , ...

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 10

Bipartite Graphs

Let G = (V , E ) be simple graph. The graph V is called


bipartite if there is a partition of V = V1 ∪ V2 such that
whenever there is an edge connecting u and v then they are
not in the same partition.
A simple graph is bipartite if and only if it is possible to assign
one of two different colors to each vertex of the graph so that
no two adjacent vertices are assigned in the same color.

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 10

Adjacency Matrix

1 2 0 1
2 0 3 0
0 3 1 1
1 0 1 0

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 10

Graph Isomorphism

Definition
The simple graphs G1 = (V1 , E1 ) and G2 = (V2 , E2 ) are
isomorphic if there exists a bijection f between V1 and V2 with
the property that

{u, v } ∈ E1 ⇐⇒ {f (u), f (v )} ∈ E 2

A property preserved by isomorphism is called a graph invariant.


For example,
same number of edges
degree of vertices

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 10

Example

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 10

Path

Let G = (V , E ) be a (simple) graph.


A path of length n from u ∈ V to v ∈ V is a sequence
x0 = u, x1 , ..., xn = v of vertices such that for i = 1, ..., n,
{xi−1 , xi } ∈ E .
A path is called simple path if it does not contain the same
edge (vertex for simple graphs) more than once.
A path is called a circuit if it begins and ends at the same
vertex.

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 10

Erdős Number

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 10

Definition
A graph is called connected if there is a path between every pair of
vertices of the graph.

Theorem
There is a simple path between every pair of distinct vertices of a
connected graph.

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 10

Bridges of Konigsberg

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 10

Euler circuit and path

An Euler circuit in a graph G is a simple circuit containing


every edge of G .
An Euler path in G is a simple path containing every edge of
G.

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 10

Results

Theorem
A connected multigraph with at least two vertices has an
Euler circuit if and only if its vertices has an even degree.
A connected multigraph has an Euler path but not an Euler
circuit if it has exactly two vertices of odd degree.

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 10

Hamilton Paths and Circuits

Definition
A simple path in a graph G that passes through every vertex
exactly once is called a Hamilton path.
A simple circuit in a graph G that passes through every vertex
exactly once is called a Hamilton circuit.

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 10

Shortest Path Problems

Graphs that have a number attached to its edges are called

weighted graphs.

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 10

Dijkstra’s Algorithm

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 10

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 10

Dijkstra’s Algorithm

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 10

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 10

The Traveling Salesperson Problem

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 10

Final exam is on Thursday, May 26


at 11 am

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 12

Week 12:
Trees

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 12

Definition
A tree is a connected graph with no simple circuits.

Theorem
An undirected graph is a tree if and only if there is a unique simple
path between any two of its vertices.

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 12

Two Examples

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 12

Rooted Trees
Definition
A rooted tree is a tree in which one vertex has been designated as
the root and every edge is directed away from the root.

Important notions:
parent
child
siblings
ancestors
descendants
leaf
internal vertices
subtree
Dr. Ferit Toska Discrete Structures
Discrete Structures
Week 12

Rooted Tree

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 12

Properties of Trees

Theorem
A tree with n vertices has n − 1 edges.

Theorem
A full m-ary tree with i internal vertices contains n = mi + 1
vertices.

Theorem
There are at most mh leaves in an m-ary tree of height h.

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 12

Applications

Binary Search
Decision Trees
Prefix Codes
Huffman Coding

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 12

Tree Traversal

Preorder traversal
Inorder traversal
Postorder traversal

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 12

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 12

Spanning Trees

Definition
Let G be a simple graph. A spanning tree of G is a subgraph of
G that is a tree containing every vertex of G .

Theorem
A simple graph is connected if and only if it has a spanning tree.

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 12

Depth-First Search

Dr. Ferit Toska Discrete Structures


Discrete Structures
Week 12

Breadth-First Search

Dr. Ferit Toska Discrete Structures

You might also like