DSAL-211-Lecture 4 - Important Discrete Mathematics
DSAL-211-Lecture 4 - Important Discrete Mathematics
DISCRETE MATHEMATICS
By
W.G. Gondwe
Lecturer, Computer Networks
CS&IT Department
Malawi University of Science & Technology
Overview
• Relevant Mathematical Concepts
• Basic Set Theory (sets, functions, relations)
• Recurrence Relations
• Combinatorics (permutations, combinations, partitions, basic graph
theory)
• Mathematical Modelling & Growth Rates
3. Factorial function:
n! = n * (n-1)!
or written as a recurrence relation:
Tn = 1 + Tn-1
Base conditions: T0 = 1
DSAL-210 - Important Discrete Mathematics 9
Recurrence relations cont…
Q: How many
permutations of the
word Mississippi?
DSAL-210 - Important Discrete Mathematics 16
Combinatorics cont..
G = {V,E}
V = {6,4,5,1,2,3}
E=
{{6,4},{4,5},{4,3},{5,1},{5,2},{3,2},{1,2}}
DSAL-210 - Important Discrete Mathematics 20
Graph theory cont..
• Graph concepts:
• Degree of a vertex – number of edge incident on a vertex (loops are
counted twice) e.g. deg(7) = 3
• Graph can be undirected or directed
• Complete graph – every pair of vertices is
connected (edge between every pair)
• Multigraph – a graph with multiple edges
between one or more pairs of vertices
inv_count := 0 1
for i := 1 to n 2
for j := i+1 to n 3
if a[i] < a[j] then 4
inv_count := inv_count + 1 5
end if 6
end for 7
end for 8
DSAL-210 - Important Discrete Mathematics 25
Mathematical modeling – Growth rates
• Types of growth rates (functions)
• Constant: f(n) = c
• Linear: f(n) = cn
• Log: f(n) = logb n
• Log-linear: f(n) = n log n Increasing
• Quadratic: f(n) = n2 + c complexity
• Cubic: f(n) = n3 + c
• Exponential: f(n) = cn
• Factorial: f(n) = n!
Graphical visualization of
algorithm complexities (growth
rates)