Questions
Write a recursive and an iterative function to calculate the nth element in a Fibonacci sequence....

Write a recursive and an iterative function to calculate the nth element in a Fibonacci sequence. A Fibonacci sequence is defined as the element 1, followed by another 1, and each element thereafter is the sum of the previous two elements. For example, the first 9 elements of a Fibonacci sequence are:

  • 1 2 3 5 8 13 21 34

This famous sequence was originally used to predict the growth of rabbit populations!

Once you have each of the functions working for n equal to 40, determine which method is more efficient by timing the two separate function calls and printing out the time required for each method call to return the 40th element in the sequence. Return the 40th element to main and print it. After that, print out a complete Fibonacci sequence from element 1 to element 40, along with its position number.

  1. 1
  2. 1
  3. 2
  4. 3

.       .

.       .

This last part should not be timed.

The timer function you need for this Project is:

                        Date d1 = new Date();

                        long milliseconds = D1.getTime();

                                                OR

                        long start = System.currentTimeMillis();

Turn in the source, output, and a short paragraph explaining the reason the two methods took different amounts of time to execute.

Please write in JAVA

and please write recursive part and iterative part separate!

In: Computer Science

Stock Price # Shares X Y Z X Y Z Jan. 13, 1999 25 40 30...

Stock Price # Shares
X Y Z X Y Z
Jan. 13, 1999 25 40 30 1000 2000 1000**
Jan. 14, 1999 25 42 7 1000 2000 5000
Jan. 15, 1999 27 42 8 1000** 2000 5000
Jan. 16, 1999 14 44 10 2000 2000 5000
*5:1 Split on Stock Z after Close on Jan. 13, 1999 **2:1 Split on Stock X after Close on Jan. 15, 1999
WHAT IS THE PRICE WEIGHTED INDEX ON JANUARY 13TH
What is the divisor at the beginning of January 14th
WHAT IS THE PRICE WEIGHTED INDEX ON JANUARY 15TH
What is the divisor at the beginning of January 16th
WHAT IS THE RETURN FROM JAN 13 TO JAN 16

In: Finance

Two dice are rolled together. If the sum of both dice is 6, what is the...

Two dice are rolled together. If the sum of both dice is 6, what is the probability that one will come in 2? (10 points)


The average weight of product A produced in a factory is 21 and the standard deviation is 5. Calculate the probabilities P (X> 20) and P (18 <P <22).

Calculate the median and standard deviation of the series below. (20 points) Classes
0-2 30
2-4 70
4-6 50
6-8 30
8-10 20

PLEASE SOLVE CORRECTLY , I have no questions remain :)

In: Statistics and Probability

PC Connection and CDW are two online retailers that compete in an Internet market for digital...

PC Connection and CDW are two online retailers that compete in an Internet market for digital cameras. While the products they sell are similar, the firms attempt to differentiate themselves through their service policies. Over the last couple of months, PC Connection has matched CDW’s price cuts, but has not matched its price increases. Suppose that when PC Connection matches CDW’s price changes, the inverse demand curve for CDW’s cameras is given by P = 1,200 - 2Q. When it does not match price changes, CDW’s inverse demand curve is P = 900 -0.5Q. Based on this information, determine CDW’s inverse demand function over the last couple of months.

P = ____- ____ Q if Q ≤ 200

      ____- ____ Q if Q ≥ 200

Over what range will changes in marginal cost have no effect on CDW’s profit-maximizing level of output?

$ _____to $ _______

In: Economics

PC Connection and CDW are two online retailers that compete in an Internet market for digital...

PC Connection and CDW are two online retailers that compete in an Internet market for digital cameras. While the products they sell are similar, the firms attempt to differentiate themselves through their service policies. Over the last couple of months, PC Connection has matched CDW’s price cuts, but has not matched its price increases. Suppose that when PC Connection matches CDW’s price changes, the inverse demand curve for CDW’s cameras is given by P = 1,000 - 2Q. When it does not match price changes, CDW’s inverse demand curve is P = 700 -0.5Q. Based on this information, determine CDW’s inverse demand function over the last couple of months.

P =______ - ________ Q if Q ≤ 200
    

      ______ - _______ Q if Q ≥ 200

Over what range will changes in marginal cost have no effect on CDW’s profit-maximizing level of output?

$ _________ to $__________

     

In: Economics

PC Connection and CDW are two online retailers that compete in an Internet market for digital...

PC Connection and CDW are two online retailers that compete in an Internet market for digital cameras. While the products they sell are similar, the firms attempt to differentiate themselves through their service policies. Over the last couple of months, PC Connection has matched CDW’s price cuts, but has not matched its price increases. Suppose that when PC Connection matches CDW’s price changes, the inverse demand curve for CDW’s cameras is given by P = 1,250 - 2Q. When it does not match price changes, CDW’s inverse demand curve is P = 800 -0.5Q. Based on this information, determine CDW’s inverse demand function over the last couple of months.

P = 800 - 0.5Q if Q ≤ 300

P = 1250 - 2Q if Q ≥ 300

Over what range will changes in marginal cost have no effect on CDW’s profit-maximizing level of output? $ $

In: Economics

There are 50 parts that are checked using a GO-NOGO gauge. A GO reading would be...

  1. There are 50 parts that are checked using a GO-NOGO gauge. A GO reading would be considered a pass (or success) for the part. What is the probability that 37 parts will successfully pass?
  2. Given the following table determine the mean and standard deviation

Score

Frequency

0-8

15

9-17

3

18-26

25

27-35

4

36-44

3

In: Statistics and Probability

Its total output (income) is $4900. Domestic consumption is $2300; total domestic government purchases are $600

 

Its total output (income) is $4900. Domestic consumption is $2300; total domestic government purchases are $600; and domestic economic investment totals $1700. The nation exports $400 and imports $100.

1) Find this nation's national savings.

2) Consider again the economy from the previous question.  

This economy runs a trade _______ and is a net ___________ other nations.

a. deficit; lender to

b. surplus; borrower from

c. surplus; lender to

d. deficit; borrower from

In: Economics

An Olympic diver is on a diving platform 6.40 m above the water. To start her...

An Olympic diver is on a diving platform 6.40 m above the water. To start her dive, she runs off of the platform with a speed of 1.21 m/s in the horizontal direction. What is the diver's speed just before she enters the water?

m/s

A football is kicked from ground level with an initial velocity of 20.6 m/s at angle of 57.0° above the horizontal.How long is the football in the air before it hits the ground? Ignore air resistance.

s

In: Physics

A slugging average of .500 or higher is considered a sign of an excellent player. Suppose...

A slugging average of .500 or higher is considered a sign of an excellent player. Suppose a player had 4 triples and a batting average of .300 in 400 at-bats (batting average = hits/at-bats). Determine a combination of singles, doubles, and home runs that gives this player a slugging average higher than .500. Still using 400 at-bats, what is the maximum number of singles this player could have with a slugging average between .500 and .700? Justify your answer.

In: Statistics and Probability