0% found this document useful (0 votes)
3 views

Module 5

Module 5 covers combinatorics, graph theory, recurrence relations, generating functions, and asymptotic analysis. It introduces basic counting principles, permutations, combinations, graph representations, algorithms, and their applications in various fields such as computer science and probability. The module also emphasizes the importance of asymptotic analysis in evaluating algorithm efficiency and scalability.

Uploaded by

Racel Cagnayo
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Module 5

Module 5 covers combinatorics, graph theory, recurrence relations, generating functions, and asymptotic analysis. It introduces basic counting principles, permutations, combinations, graph representations, algorithms, and their applications in various fields such as computer science and probability. The module also emphasizes the importance of asymptotic analysis in evaluating algorithm efficiency and scalability.

Uploaded by

Racel Cagnayo
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Module 5: Combinatorics: Counting Techniques and Applications

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.

 Permutations: Arrangements of objects where order matters.


o The number of permutations of 'n' distinct objects is n! (n factorial).

o The number of permutations of 'n' objects taken 'r' at a time is:

 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).

 Combinations: Selections of objects where order does not matter.


o The number of combinations of 'n' objects taken 'r' at a time is:

 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 Computer science (algorithm analysis, data structures).

o Cryptography.

o Scheduling problems.

2. Graph Theory: Graph Representations, Algorithms, and Applications


Graph theory studies graphs, which are mathematical structures used to model pairwise relations
between objects.
 Graph Representations:
o Adjacency Matrix: A square matrix where the entry at row 'i' and column 'j'
indicates whether there is an edge between vertices 'i' and 'j'.
o Adjacency List: A list of neighbors for each vertex.

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 Minimum Spanning Tree (MST) Algorithms (Kruskal's, Prim's): Finds a subset


of edges that connects all vertices with minimum total weight.
 Applications:
o Network routing.

o Social network analysis.

o Scheduling and resource allocation.

o Circuit design.

o Map coloring.

o Database relations.

3. Recurrence Relations and Generating Functions


 Recurrence Relations: Equations that define a sequence recursively, where each term is
defined as a function of preceding terms.
o Example: The Fibonacci sequence: F(n)=F(n−1)+F(n−2), with F(0)=0 and F(1)=1.

o Solving Recurrence Relations: Techniques like substitution, iteration, and the


characteristic equation method.

 Generating Functions: Power series that encode a sequence.


o Example: The generating function for the sequence 1, 1, 1, ... is:

 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.

 Example: f(n)=3n2+5n+1 is O(n2).


o Big Omega Notation (Ω): Describes the lower 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.

o Comparing the performance of different algorithms.

o Understanding the scalability of algorithms.

 Examples:
o Linear Search is O(n)

o Binary search is O(log n)

o Bubble sort is O(n^2)

o Merge sort is O(n log n)

You might also like