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 if
7: 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.:- M93083377
  • Price:- $10

Priced at Now at $10, Verified Solution

Have any Question?


Related Questions in Business Management

What is the difference is between a leader of change and a

What is the difference is between a leader of change and a change champion? In what ways are the differences meaningful?

Is there any difference in terms of the information that

Is there any difference in terms of the information that could be provided to the decision maker by an IS that was created using HSM and an IS that was created using SSM?

For each of the following draw supply and demand graph that

For each of the following, draw supply and demand graph that presents market for eggs in initial equilibrium, then illustrate the likely effects on the market for eggs (supply or demand) each of the following events. Ind ...

All of the following are guidelines for self awareness

All of the following are guidelines for self awareness training except?

Briefly discuss the advantages and disadvantages of line

Briefly discuss the advantages and disadvantages of line balancing?

What are the best practices a firm should follow to better

What are the best practices a firm should follow to better ensure compliance with US export controls?

Concentration ratios are typically a firms share of

Concentration ratios are typically a firm's share of domestic production. If the United States engages in more international trade, will such concentration measures lose meaning? Could this effect explain the vanishing o ...

What is the benefit the beyond budgeting please also

What is the benefit the Beyond budgeting? Please also explain how each are used.

You are a physician making rounds on your patients when you

You are a physician making rounds on your patients when you arrive at Mrs. Buckman's room. She's an elderly lady in her late 70s who recently had colon surgery. She is also the wife of a prominent physician at the hospit ...

Why is formative evaluation importantprovide at least three

Why is formative evaluation important? Provide at least three reasons for using it. What is the difference between formative and summative evaluation? Provide any two types formative evaluation and two types of summative ...

  • 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