Question: python: function that calculates determinant recursively but for matrix that are tridiagonal. that is is uses det ( A ) = j = 0 (

python: function that calculates determinant recursively but for matrix that are tridiagonal. that is is uses det(A)=
j=0
(1)j det(B0,j)A[0,j] with Bi,j the matrix built from A by removing the i-th row and j-th column. so for tridiagonal the loop is not for i in range (n) but in range [0,1]. for such algorithm i have to calculate time complexity. the answer is # loop iteration: 1 add +1 power +2 mult =4= p # 0.2 pts
# recursion:
# n =1: 0 # 0.1 pts
# n =2: T(2)= p + p =2 p # 0.1 pts (2 loop iterations, no cost for determinant)
# n =3: T(3)=2 x (p + T(2))=2 x (3 p)=6 p # 0.1 pts
# n =4: T(4)=2 x (p + T(3))=2 x (7 p)=14 p
# n =5: T(5)=2 x (p + T(4))=2 x (15 p)=30 p
# For writing/recognizing the geometric sum: # 0.4 pts
# n: T(n)=2 x (p + T(n-1))=(2^ n -2) p # 0.1 pts (solving the geo sum)
# => total: O(n)= T(n) but i only understand cases n=0 and n=1. could you explain the next cases and from where this pattern comes from?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!