Homework # 1 CS502 Analysis of Algorithms
Problem 1:
Using direct proof, prove that if is an integer which is divisible by 5 then 3 is divisible by 15
If is divisible by 5, so
= 5 where ,
Multiplying both sides by 3
3 = 3 5
3 = 15
Hence proved if any nu
1. Find the specific solution and cross check your answer
= 1 + 42 + 43
Where,
0 = 8,
1 = 6, and
2 = 26
Method of Characteristic Roots
Let = , Substituting this in original recurrence relation, we have:
= 1 + 4 2 + 4 3
= 1 + 4 2 + 4 3
Dividing by 3, we
1. We have two algorithms which solve the same problem. The variable p is a
probability value so that 0 p 1.
Algorithm 1 has an average complexity of
1 () = + (1 )
Algorithm 2 has an average complexity of
2 () =
a. Solve for the expression for the value
Linear Programming
Linear Programming or Mathematical Programming involve a set of variables
related by a set of mathematical equations, referred to as constraints and an
objective function.
Example: Maximize
x1 + x2
Subject to the constraints:
-x1 + x2 5
Asymptotic Notation
Allows us to compare the complexity of a given function to a
known complexity.
We are mainly interested in the growth of functions as n gets
large, goes to infinity.
Asymptotic Notation - 2013
Asymptotic Notation O, , and
Set Notation
Theorem: The average number of comparisons Cn to Quicksort a random file of N elements is
approximately 2nlnn.
Assume C0 = C1 = 0
Proof of Average Complexity of Quicksort
Cn = n + 1 + (C0 + Cn-1) + (C1 + Cn-2) . + . (Ck-1 + Cn-k) . + . +(Cn-1 + C0)/n
n is
Pattern Matching finding an occurrence of a string within another string
Technique used in searches to find a pattern in a file, for example.
Initial Idea: Brute Force Algorithm
TEXT: acabdaccacac = t0t1t2t3t4t5t6t7t8t9t10t11 where the length of the text