Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Business Management Expert

Below is the definition of the useless function:

1: function useless(n)

2: if n = 1 then

3: return 1

4: else

5: return useless(random(1, n))

6: end if7: endfunction

where random(1, n) returns a uniformly distributed random integer in the range 1 . . . n.

Assuming an initial call to the function useless(m).

Point: The function will return 1 or will run infinitely.

Q1. How to prove it formally?

Point: Call to random function on line 5 will occurred whenever m is not equal to 1 and it will be infinite until m equals to 1.

Q2. So, how exactly we can calculate the expected no. of calls to random function?

Point: For best case scenario of useless function [useless(1)], calls for random function will be 0.

Q3. But what about the worst case scenario(useless(n) where n not equal to 1), how many times random function will be called?

Business Management, Management Studies

  • Category:- Business Management
  • Reference No.:- M93084991
  • Price:- $10

Priced at Now at $10, Verified Solution

Have any Question?


Related Questions in Business Management

Some goods are normal goods at lower income levels and

Some goods are normal goods at lower income levels and inferior goods at higher income levels. One example is the fast food category in the US restaurant industry (e.g., McDonalds). In this case, lower income consumers w ...

How does he the false of bait and advertising become

How does he the false of bait and advertising become problem in current and future healthcare facility?

The standard deviation of the number of video game as

The standard deviation of the number of video game A's outcomes is 1.8940, while the standard deviation of the number of video game B's outcomes is 1.6179. Which game would you be likely to choose if you wanted players t ...

In light of the winners curse must winning bidders in

In light of the winner's curse, must winning bidders in auctions necessarily "lose" in the sense of paying more than the acquired firm (or product) is worth? What steps can bidders take to prosper in auctions and/or corp ...

Do an analysis on the financial statement attached relating

Do an analysis on the financial statement attached relating to its: strategy , accounting, business, financial. Note to comment on the Ratio analysis, and the cash flow analysis e.g. ROE, EBIT, Liquidity analysis, Debt a ...

What are the similarities and differences between emotions

What are the similarities and differences between emotions and moods? What are the basic emotions and the basic mood dimensions?

Suppose an individuals budget and prices of commodities she

Suppose an individual's budget and prices of commodities she faces are respectively I = 50,px = 2,py =3. If the individual's utility function is given by U(x,y) = √xy. What's her preferred consumpution bundle? If the ind ...

Companies persue closer coordination and collaboration with

Companies persue closer coordination and collaboration with channel suppliers to better address customer needs inorder to 1) Develop human resource management activities that improve the skills, expertise and knowledge o ...

Assume that the car lot contains 25 percent porches 35

Assume that the car lot contains 25 percent Porches, 35 percent BMWs, and 40 percent Volvos. Of the Porches, 20 percent have navigation systems, 90 percent of the BMWs have navigation systems, and 70 percent of the Volvo ...

With respect to your use of the internet what is an example

With respect to your use of the Internet, what is an example of an exposure? An uncertainty? A missed opportunity?

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As