Find a value for n that causes the original function to run

Assignment Help Other Subject
Reference no: EM131927152

Lab - Memoization

Part I - Laboratory Activities: Memoization

ACTIVITY: Counting nodes

In the Fibonacci tree for n = 5, how many times do you see:

  • The value 3?
  • The value 2?

In the Fibonacci tree for n = 7, how many times do you see:

  • The value 4?
  • The value 3?

Advanced: How many nodes in total for a Fibonacci tree for any size n?

ACTIVITY: Counting nodes, again

Consider the diagram on Slide 14:

How many times do you see:

  • The value 3 circled? Squared?
  • The value 2 circled? Squared?

Draw a Fibonacci tree for n = 7 showing memoization when it occurs. How many times do you see:

  • The value 4 circled? Squared?
  • The value 3 circled? Squared?

How many nodes in total are either circled or squared?

Compare these values to the previous diagram.

ACTIVITY: Fibonacci vs fibm

Find a value for n that causes the original function (Slide 4) to run for a few seconds.

Something in the range 30-50, depending on your computer.

Run the memoized version (Slide 12) on that value of n.

Run the memoized version on larger n.

Comment on the time you spend waiting for these functions.

ACTIVITY: Moosonacci numbers

Recall the Moosonacci problem, from Assignment 7.

Like Fibonacci, it's very inefficient.

Apply the memoization technique to the function moosonacci.

Compare the two versions using the timing method (Lab 06).

Attachment:- Assignment Files.rar

Reference no: EM131927152

Questions Cloud

Since the dns zones can be hosted on specific ad domain : Since the DNS zones can be hosted on specific AD domain controllers, what factor(s) might go into deciding which DCs will host DNS?
What is the essence of their ideas in the article : It is required to submit a very brief (two to three sentences) summary of the main points of the author(s). What is the essence of their ideas?
Research on the internet about database normal forms : Conduct your own research on the Internet about database normal forms. Post your website link at this discussion board and list the 3 most important concepts
What is the total crashing cost : A new order filling system needs to be installed as soon as possible. The table on the next page lists the project's activities and their predecessors.
Find a value for n that causes the original function to run : Lab - Memoization - ACTIVITY: Fibonacci vs fibm - Find a value for n that causes the original function (Slide 4) to run for a few seconds
Describe various ways of how to counter those objections : Thinking about bio-metric authentication, list three reasons why people may be reluctant to use bio-metrics. Describe various ways of how to counter
Why are control structures important : There are many types of control structures. Why are control structures important? Are control structures universal to all programming languages?
Customers data private with the use of super computers : Describe why is data encryption so important for a company that is trying to keep their customers data private with the use of Super Computers.
What you have heard and seen in the media : Select a "hot topic" of cognitive psychology based on what you have heard and/or seen in the media and your personal interests.

Reviews

len1927152

4/4/2018 1:20:15 AM

Detailed Question: Hand in your lab10-responses.txt le showing: Your comments for the Activity on Slide 16. Your implementation of the memoized moosonacci function from the Activity on Slide 17. Repeatedly calculating the same data over and over makes this recursive Fibonacci function very inefficient. Principle: Never repeat a calculation except if it is very simple.

Write a Review

Other Subject Questions & Answers

  Cross-cultural opportunities and conflicts in canada

Short Paper on Cross-cultural Opportunities and Conflicts in Canada.

  Sociology theory questions

Sociology are very fundamental in nature. Role strain and role constraint speak about the duties and responsibilities of the roles of people in society or in a group. A short theory about Darwin and Moths is also answered.

  A book review on unfaithful angels

This review will help the reader understand the social work profession through different concepts giving the glimpse of why the social work profession might have drifted away from its original purpose of serving the poor.

  Disorder paper: schizophrenia

Schizophrenia does not really have just one single cause. It is a possibility that this disorder could be inherited but not all doctors are sure.

  Individual assignment: two models handout and rubric

Individual Assignment : Two Models Handout and Rubric,    This paper will allow you to understand and evaluate two vastly different organizational models and to effectively communicate their differences.

  Developing strategic intent for toyota

The following report includes the description about the organization, its strategies, industry analysis in which it operates and its position in the industry.

  Gasoline powered passenger vehicles

In this study, we examine how gasoline price volatility and income of the consumers impacts consumer's demand for gasoline.

  An aspect of poverty in canada

Economics thesis undergrad 4th year paper to write. it should be about 22 pages in length, literature review, economic analysis and then data or cost benefit analysis.

  Ngn customer satisfaction qos indicator for 3g services

The paper aims to highlight the global trends in countries and regions where 3G has already been introduced and propose an implementation plan to the telecom operators of developing countries.

  Prepare a power point presentation

Prepare the power point presentation for the case: Santa Fe Independent School District

  Information literacy is important in this environment

Information literacy is critically important in this contemporary environment

  Associative property of multiplication

Write a definition for associative property of multiplication.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd