1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
topjm [15]
3 years ago
15

Answer the question.

Mathematics
1 answer:
Veronika [31]3 years ago
3 0

Answer:

Kerry won new york

Step-by-step explanation:

You might be interested in
The fundamental source of the inefficiency is not the fact that recursive calls are being made, but that values are being recomp
Fudgin [204]

Step-by-step explanation:

<em>(you can download the attached PDF for a better view)</em>

The Fibonacci sequence is a well-known mathematical sequence in which each term is the sum of the two previous terms.

More specifically, if fib(n) is the nth term of the sequence, then the sequence can be defined as follows:

fib(0) = 0

fib(1) = 1

fib(n) = fib(n-1) + fib(n-2) n>1

1. Because the Fibonacci sequence is defined recursively, it is natural to write a recursive method to determine the nth

number in the sequence. File Fib.java contains the skeleton for a class containing a method to compute Fibonacci

numbers. Save this file to your directory. Following the specification above, fill in the code for method fib1 so that it

recursively computes and returns the nth number in the sequence.

2. File TestFib.java contains a simple driver that asks the user for an integer and uses the fib1 method to compute that

element in the Fibonacci sequence. Save this file to your directory and use it to test your fib1 method. First try small

integers, then larger ones. You'll notice that the number doesn't have to get very big before the calculation takes a very

long time. The problem is that the fib1 method is making lots and lots of recursive calls. To see this, add a print

statement at the beginning of your fib1 method that indicates what call is being computed, e.g., "In fib1(3)" if the

parameter is 3. Now run TestFib again and enter 5—you should get a number of messages from your print statement.

Examine these messages and figure out the sequence of calls that generated them. (This is easiest if you first draw the

call tree on paper.) . Since fib(5) is fib(4) + fib(3),you should not be surprised to find calls to fib(4) and fib(3) in the

printout. But why are there two calls to fib(3)? Because both fib(4) and fib(5) need fib(3), so they both compute it—very

inefficient. Run the program again with a slightly larger number and again note the repetition in the calls.

3. The fundamental source of the inefficiency is not the fact that recursive calls are being made, but that values are being

recomputed. One way around this is to compute the values from the beginning of the sequence instead of from the end,

saving them in an array as you go. Although this could be done recursively, it is more natural to do it iteratively. Proceed

as follows:

a. Add a method fib2 to your Fib class. Like fib1, fib2 should be static and should take an integer and return an integer.

b. Inside fib2, create an array of integers the size of the value passed in.

c. Initialize the first two elements of the array to 0 and 1, corresponding to the first two elements of the Fibonacci

sequence. Then loop through the integers up to the value passed in, computing each element of the array as the sum

of the two previous elements. When the array is full, its last element is the element requested. Return this value.

d. Modify your TestFib class so that it calls fib2 (first) and prints the result, then calls fib1 and prints that result. You

should get the same answers, but very different computation times.

// ******************************************************************

// Fib.java

//

// A utility class that provide methods to compute elements of the

// Fibonacci sequence.

// ******************************************************************

public class Fib

{

//--------------------------------------------------------------

// Recursively computes fib(n)

//--------------------------------------------------------------

public static int fib1(int n)

{

//Fill in code -- this should look very much like the

//mathematical specification

}

// ******************************************************************

// TestFib.java

//

// A simple driver that uses the Fib class to compute the

// nth element of the Fibonacci sequence.

// ******************************************************************

import java.util.Scanner;

public class TestFib

{

public static void main(String[] args)

{

int n, fib;

Scanner scan = new Scanner(System.in);

System.out.print("Enter an integer: ");

n = scan.nextInt();

fib = Fib.fib1(n);

System.out.println("Fib(" + n + ") is " + fib);

}

}

Download pdf
8 0
3 years ago
Read 2 more answers
What is 2(×-2)+3(×+5) simplifies​
Neko [114]

Answer:

5x+9

Step-by-step explanation:

2(x-2)+3(x+5)

2x-4+3x+15

2x+3x-4+15

5x+9

6 0
3 years ago
I really dont get it halp ;-;
erik [133]

Answer:

II

Step-by-step explanation:

This would be easier to explain to you on a graph, but I shall do the best I can in text format.

You know what a complex plane looks like, right? Just like a number line but with a vertical number line added on at the point (0). This makes four quadrants, you know the drill.

So each quadrant holds all values from on of the four positive/negative combinations, (1, 1i), (1, -1i), (-1, -1i), and (-1, 1i), in that order.

So this means that all the pairs with both positive values are in quadrant I, all the pairs with a positive rational number but a negative irrational number are in II, etc.

If you have a graph, you can simply count along the number line to find the answer, so in this case, starting as always at (0, 0), move 6 units to the right and then eight units down, where you end up in the lower righthand quadrant, which is II.

Oof I know that was worded badly but I hope it's not totally useless to you <3

You're doing great with the test, Gem, I'm sure you'll do just fine <:

6 0
3 years ago
Read 2 more answers
Y∝√x If y=60 when x=36 find,y when x=16
avanturin [10]

Answer:

y = 10√16) = 40

Step-by-step explanation:

This says, "y is proportional to the square root of x."  We are told that y = 60 when x = 36.  Find the formula for this function.  Then, determine what value y will take on when x = 16.

y = k√x  becomes 60 = k√36, or 60 = 6k.  Then k must be 10, and the formula is y = 10√x.

If x = 16, y = 10√16) = 40

7 0
3 years ago
I WILL MARK BRAINLIEST!!! !!<br><br><br> (picture included with 1 question ^^^^^)
patriot [66]

Answer:

whats the qus..........

4 0
3 years ago
Other questions:
  • Triangle $abc$ has vertices at $a(5,8)$, $b(3,-2)$, and $c(6,1)$. the point $d$ with coordinates $(m,n)$ is chosen inside the tr
    8·1 answer
  • What is 10 plus 10 minus 4 and 8 divided by the total?
    14·2 answers
  • Theresa earned scores of 88 points, 84 points, 88 points, and 91 points on four tests. What is the lowest score she can get on t
    5·2 answers
  • If f(x)=-12x−3, find x for f(x)=89.
    12·2 answers
  • The sum of three consecutive integers is -78. determine the smallest integer.
    12·1 answer
  • Pls help if u can 6th grademath
    7·1 answer
  • Plz, help if you are an expert at math. his lesson is called "Equations with variables on both sides" thanks
    6·1 answer
  • Deshawn has two bags of marbles. The first bag has 2 blue, 3 orange, and 5 red. The second bag has 4 pink, 10 blue, and 6 brown.
    7·1 answer
  • A polynomial function has a zero at 4 (multiplicity 3) and 0 (multiplicity 1). Write a function in standard form that can repres
    9·1 answer
  • Reduce 320/95 for me pls
    5·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!