Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Consider the method that recursively calculates the Fibonacci sequence: [1 pt] How many problems are at the deepest level in the recursion tree? [1 pt]

  1. Consider the method that recursively calculates the Fibonacci sequence:

[1 pt] How many problems are at the deepest level in the recursion tree?

[1 pt] How many leaves are in the recursion tree as a function of n?

[1 pt] How many levels are in the recursion tree as a function of n?

int fib( int n )

{

if ( ( n == 0 ) || ( n == 1 ) ) {

return n;

}

else {

return ( f(n-1) + f(n-2) );

}

}

Assume that you are going to do this with all the recursive calls, rather than calculating and storing intermediate results (silly, I know, but for the purpose of this problem, its what Im looking for). For this problem, you may assume that n > 2.

[2 pts] Draw the top three levels of the recursion tree for fib(n)

  1. Suppose that your friend decides to go to college at Metro State, and unlike most students, they plan to take all their courses here. They are going to go to school full time, taking three 4-credit courses every semester. They are going to major in Computer Science and minor in Math. Theyre very picky, so they plan to take 30 specific courses to graduate.

Assume that there is a 4-year schedule available (ha!) so that they know the day of every course, every semester, and the prerequisites for every course. Assume they only want to take courses that meet once per week in the evenings.

Using no more than the rest of this page, how would you approach this problem, using the techniques of solving constraint satisfaction problems that you have learned so far in this course? What algorithm(s) would you use, why, in what order?

Note that this is an intentionally open-ended question. There are a number of good strategies. One real challenge is to concisely explain what choices you made, and why you made the choices that you did.

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_2

Step: 3

blur-text-image_3

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

Data Analytics And Quality Management Fundamental Tools

Authors: Joseph Nguyen

1st Edition

B0CNGG3Y2W, 979-8862833232

More Books

Students also viewed these Databases questions

Question

What is a benefi t change log?

Answered: 1 week ago

Question

2. Develop a persuasive topic and thesis

Answered: 1 week ago

Question

1. Define the goals of persuasive speaking

Answered: 1 week ago