2. General plan
• Decide the input size.
• Identify basic operations.
• Check how many time basic operations is
executed & determine best,worst,avg case
analyzed seperately.
• Set up sum for basic operation.
• Simplifying the sum using std formula &
rules.
3.
4. • The input size is n.
• The basic operation is comparison in loop for
finding largest value.
• Comparison made for each value for n.
• C(n) be the no.of.times comparison is executed.
• C(n)=one comparison.
• Simplify the sum.
Mathematical analysis
5.
6.
7. Mathematical analysis
• The input size of the problem is n
• The basic operation is if A[i]==A[j]
• The outter loop will be executed first to last but
one element and inner loop is executed 2 to n
arrary index.
• C(n) no.of.comparison statement is executed in
worstcase.