Presentation is loading. Please wait.

Presentation is loading. Please wait.

Recursion and Recurrence Relations

Similar presentations


Presentation on theme: "Recursion and Recurrence Relations"— Presentation transcript:

1 Recursion and Recurrence Relations
An Introduction

2 Recursion A technique of defining a function, a set or an algorithm in terms of itself is a “recursion”. For Example: Factorial !n=n X !(n-1), and !0=!1=1 Fibonacci sequence f0 =1, f1 =1 and fk =fk-2 +fk-1 for k≥2

3 Solution of a problem with recursion and Iteration
Lets solve this problem with to methods Recursion Iteration Telescoping form of a polynomial expression Eg. X5 + 3x4 – 15x2 +x -10 Its telescoping form is (((x((x)+3)))x-15)x+1)x-10

4 Types of Recurrence Relation
Linear Recurrence relation with constant coefficients. c0 ar + c1 ar-1 + c2 ar-2 + ……..+ ck ar-k =f(r) Homogeneous recurrence Relation s(k)+c1 s(k-1) +c2 s(k-2)+…….+ cn s(k-n)=f(k) and f(n)=0 Non-Homogeneous recurrence Relation s(k)+c1 s(k-1) +c2 s(k-2)+…….+ cn s(k-n)=f(k) and f(n)=non-zero.


Download ppt "Recursion and Recurrence Relations"

Similar presentations


Ads by Google