Question: Write an python function that gets n and returns the nth value in the Pell sequence. Pell sequence is defined by P(n) = 2*P(n-1) +
Write an python function that gets n and returns the nth value in the Pell sequence. Pell sequence is defined by
P(n) = 2*P(n-1) + P(n-2) while P(0) = 0 and P(1) = 1. Use your code to generate and provide the first 10 values of Pell sequence.
def pell(n):
Run an analysis of the function developed in above and find its T(n) and big O performance. Is finding the nth element of Pell sequence faster than bubble sort? Is it faster than finding the nth element of the Fibonacci series?
Step by Step Solution
3.35 Rating (164 Votes )
There are 3 Steps involved in it
Heres a Python function to calculate the nth value in the Pell sequence python def pelln if n 0 retu... View full answer
Get step-by-step solutions from verified subject matter experts
