Professional Documents
Culture Documents
DAA Assignment-1
DAA Assignment-1
DAA Assignment-1
AY-2023- 24
Algorithm:
A. Recurrence Relation:
A recurrence relation defines the time
complexity of an algorithm recursively. It expresses
the time or space complexity of a problem in terms
of the size of its smaller instances. Recurrence
relations are often used to analyse the time
complexity of recursive algorithms.
T(n)=T(n-1)+n(n-1) if n>=2
Given,
T(1)=1
T(3)=T(2)+3(3-1)
=3+6
=9
T(4)=T(3)+4(4-1)
=9+12
=21
T(n)=T(n-1)+n(n-1) is:
T(n)=O(n)