Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

(Elegant Fibonacci) In class we saw that the 22 matrix F = 0 1 1 1 is a generator of sorts for the Fibonacci numbers.

(Elegant Fibonacci) In class we saw that the 22 matrix F = 0 1 1 1 is a generator of sorts for the Fibonacci numbers. That is, the lower left entry of F n is exactly Fn, the nth Fibonacci number. The following elegant algorithm, fibel(n), computes the nth Fibonacci number using the matrix F . In particular, if n is a power of 2, the nth power of F is computed by squaring F lg n times. Otherwise, if n is not a power of 2, and say that n = bkbk1 . . . , b2b1 (in binary), then F n is the product of F 2i over all i such that bi = 1. fibel(n) compute n in binary, say n = b[k]b[k-1]. . . b[1], where each b[i] {0, 1}. if b[1]=1 then total:= F else total:=I2 (2 2 identity matrix) for i := 2 to k do F := F F if b[i]=1 then total:=totalF return lower left entry of total You may assume that the time it takes to compute n in binary is (lg n). What is the runtime of fibel(n)?

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

Recommended Textbook for

Big Data Concepts, Theories, And Applications

Authors: Shui Yu, Song Guo

1st Edition

3319277634, 9783319277639

More Books

Students also viewed these Databases questions

Question

b. Will there be one assigned leader?

Answered: 1 week ago

Question

Prepare a short profile of Lucy Clifford ?

Answered: 1 week ago

Question

Prepare a short profile of Rosa parks?

Answered: 1 week ago

Question

Prepare a short profile of victor marie hugo ?

Answered: 1 week ago