0% found this document useful (0 votes)
9 views103 pages

Unit2-1

Uploaded by

utubead420
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views103 pages

Unit2-1

Uploaded by

utubead420
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 103

UNIT 2

Proofs, Relations and Analysis of


Algorithm
BY ANANYA PANDEY
Today’s Agenda

1. Introduction to proofs
2. Methods to prove a conditional statement
3. Examples on each of the methods
Learn How To Write Steps In Exams!!
Proof by Contradiction
Unit 2
Proofs, Relations and Analysis
of Algorithm

BY ANANYA PANDEY
Principle of Mathematical Induction
– (23 – 2a)

CS-708 3
Example – (23- 3)

CS-708 4
Solution – (23 – 3a)

CS-708 5
Solution – (23 – 3b)

CS-708 6
Solution – (23 -
4)

CS-708 7
Solution – (23 – 4a)

CS-708 8
Solution – (23 – 4b)

CS-708 9
Solution – (23 – 4c)

CS-708 1
0
Exercise – (23 - 5)

CS-708 11
Exercise – (23 – 5a)

CS-708 12
Solution – (23 -
6)

CS-708 13
Solution – (23 – 6a)

CS-708 14
Solution – (23 – 6b)

CS-708 15
Exercise – (23 - 7)

CS-708 16
Solution – (23 – 7a)

CS-708 17
Solution – (23 -
8)

CS-708 18
Solution – (23 – 8a)

CS-708 19
Exercise – (23 - 9)

CS-708 20
Solution – (23 - 10)

CS-708 21
Solution – (23 –
10a)

CS-708 22
Solution – (23 - 11)

CS-708 23
Solution – (23 –
11a)

CS-708 24
Exercise – (23 - 12)

CS-708 25
Solution – (23 - 13)

CS-708 26
Solution – (23 –
13a)

CS-708 27
Solution – (23 –
13b)

CS-708 28
Example – (23 - 15)

CS-708 29
Solution – (23 –
15a)

CS-708 30
Solution – (23 - 16)

CS-708 31
Solution – (23 –
16a)

CS-708 32
Solution – (23 –
16b)

CS-708 33
Solution – (23 - 21)

CS-708 34
Unit 2
Proofs, Relations and Algorithms
By ANANYA PANDEY
Recursive Definition

In mathematics and computer science, a recursive definition, or


inductive definition, is used to define the elements in a set in
terms of other elements in the set. For example: Factorials,
Fibonacci series etc.
Recursive Definition
• Example to get more clarity about recursion:
a1=3
an=an-1+5 , 2<= n <infinity
A formula like this, in which the previous terms is referred to define the next
term is called as recursive.

• The sequence 3,7,11,15,19,23…….


Can be defined by the recursive formula:
a1=3
an= an-1+4
Recurrence Relation
• When a problem is to find a recursive formula for a recursively
defined sequence then such recursive formula is called as a
Recurrence Relation.
• fn=fn-1 +fn-2, f1=f2=1
(it is recurrence relation for Fibonacci series)
1,1,2,3,5,8,13,21……..
Linear Recurrence Relation with constant coefficient
Unit 2
Lecture 4
BY ANANYA PANDEY
What are divide and conquer Algorithms?
This technique can be divided into the following three parts:
1. Divide: This involves dividing the problem into smaller sub-problems.
2. Conquer: Solve sub-problems by calling recursively until solved.
3. Combine: Combine the sub-problems to get the final solution of the whole problem.

The following are some standard algorithms that follow Divide and Conquer technique:

Quick sort, Merge Sort, Binary Search, Selection Sort.


Recurrence relation for binary search
Master’s Theorem
It is used to solve Recurrence Equation of the form:
T(n)=aT(n/2) + (n^k log^pn) where , a>=1, b>1, k>=0 and p is a real number.

You might also like