1
1
Algorithms
4th Semester, CST Department
Theory Paper
Complexity asymptotic bounds
An approximate measure of the time taken for
the program to run
Stated as a function f(n) of the problem size
Problem size for sorting size of the array
Factorization of one integer its magnitude
Inequality in terms of known function g(n)
c1 2 g(n) for all n > n0
Complexity asymptotic bounds
Tight bound Big theta f(n) = (g(n))
c1 2 g(n)
Tight upper bound Big-O f(n) = O (g(n))
2 g(n)
Tight lower bound Big Omega f(n) = (g(n))
c1
Upper bound small-o f(n) = o (g(n))
f(n) < c2 g(n)
Lower bound small-omega f(n) = (g(n))
c1 g(n) < f(n)
Outline Syllabus different paradigms
Divide and conquer approach
Sorting algorithms
Dynamic programming approach
Matrix multiplication
Greedy strategy
Minimum spanning tree in graph
Backtracking strategy
Depth first and breadth first search in graph
Outline syllabus -
some data structures and operations
Operation on Disjoint sets
Shortest path in graph
Operation on dynamic sets
Hashing
Operation on Polynomials
FFT algorithm
Operations in number theory
RSA algorithm
Outline syllabus advanced topics
Complexity theory
Randomized algorithms
Parallel algorithms
NP completeness
Approximation algorithms
Divide and conquer strategy
DIVIDE into subproblems
CONQUER the subproblems solving recursively
COMBINE the solutions of subproblems
RANDOMIZED_PARTITION(A,p,r)
i=RANDOM(p,r)
exchange A[p] with A[i]
return PARTITION(A,p,r)
Time Complexity of Selection
To find an upper bound T(n) on expected time
- k,n-k)))+O(n)
-
[max(k,n-k) = k or n-k split at k=n/2]
In worst case, T(n-1) =O(n^2) so that T(n-1)/n = O(n)
cn cn
One example case for SELECT