Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions