Module 5
Module 5
Combinatorics is the branch of mathematics concerned with counting, both as a means and an
end in obtaining results, and certain properties of finite structures.
Basic Counting Principles:
o Rule of Sum (Addition Principle): If there are 'm' ways to do one thing and 'n'
ways to do another, and these two things cannot be done at the same time, then
there are m + n ways to do either one.
Example: You have 3 different novels and 5 different textbooks. You can
choose either a novel or a textbook in 3 + 5 = 8 ways.
o Rule of Product (Multiplication Principle): If there are 'm' ways to do one thing
and 'n' ways to do another, then there are m × n ways to do both.
Example: You have 3 shirts and 4 pants. You can create 3 × 4 = 12 different
outfits.
P(n,r)=(n−r)!n!
Example: How many ways can you arrange 3 letters from the word "CAT"?
P(3,3)=(3−3)!3!=16=6 (CAT, CTA, ACT, ATC, TAC, TCA).
C(n,r)=(rn)=r!(n−r)!n!
Example: How many ways can you choose 2 fruits from a basket of 4 fruits
(apple, banana, orange, grape)?
C(4,2)=(24)=2!(4−2)!4!=2×224=6 (AB, AC, AD, BC, BD, CD).
Applications:
o Probability calculations.
o Cryptography.
o Scheduling problems.
o Example: A graph with vertices A, B, and C, with edges (A, B) and (B, C).
Adjacency Matrix:
[010]
[101]
[010]
Adjacency List:
A: B
B: A, C
C: B
Graph Algorithms:
o Depth-First Search (DFS) and Breadth-First Search (BFS): Algorithms for
traversing graphs.
o Dijkstra's Algorithm: Finds the shortest path between two vertices.
o Circuit design.
o Map coloring.
o Database relations.
G(x)=1+x+x2+x3+...=1−x1
o Generating functions can simplify solving recurrence relations and counting
problems.
Applications:
o Analysis of algorithms.
o Combinatorial counting.
o Probability theory.
4. Asymptotic Analysis
Asymptotic Analysis: Studies the limiting behavior of functions as input size grows.
o Big O Notation (O): Describes the upper bound of a function's growth rate.
o Big Theta Notation (Θ): Describes the tight bound of a function's growth rate.
Importance:
o Analyzing the efficiency of algorithms.
Examples:
o Linear Search is O(n)