Definition of the useless function

Assignment Help Business Management
Reference no: EM132100471

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?

Reference no: EM132100471

Questions Cloud

Explain the value of receiving feedback from your team : Explain the value of receiving feedback from your ‘team' on the various sections of your non-alcoholic beverage business plan.
Provide a seating order that conforms : Provide a seating order that conforms to the above rules. An example of an invalid seating order is:
Describe some of the problems that might arise : Describe some of the problems that might arise in a group project and suggest one or more strategies for dealing with those problems.
Personal genetic data in privately owned computer databases : How does the practice of storing personal genetic data in privately owned computer databases raise issues affecting information ownership and property-rights?
Definition of the useless function : Below is the definition of the useless function:
Related the relationship between supply and demand : Related the relationship between supply and demand? Explain how this is possible?
Define similarities-nursing process and strategic planning : The nursing process provides a cornerstone for care. Engaging in assessment, diagnosis, planning, implementation, and evaluation helps to move the patient.
Portuguese telecommunications company that encountered : Marconi is a Portuguese telecommunications company that encountered problems with its ABC system.
What is meant by modular design : What is meant by modular design? How is it implemented in C#?

Reviews

Write a Review

Business Management Questions & Answers

  What kinds of data is collected

Find a case study or article about a business that has been benefited from using big data to generate more profit or customer base. What kinds of data is collected

  Advance comparative statistics

Go to the Census Bureau Web site at www.census.gov and select Economic Census, then 2007 Economic Census, Core Business Statistics and then Advance Comparative Statistics. For the Construction industry

  Are managers and leaders sometimes forced to use techniques

Are you a strong enough leader yourself to employ best practices as you move forward in your career? Or are managers and leaders sometimes forced to use techniques that you consider "poor" at this point in your career?

  What are the steps in implementing change

What are the steps in implementing change? What should you consider when selecting a change implementation model? Explain.

  Evening paul emailed acceptance

That evening Paul emailed acceptance of the offer to Katherine. She immediately phoned him to tell him that she had revoked the offer that afternoon, and he would surely receive it in tomorrow's mail. Was the offer revoked by Katherine?

  Explaining change management with who moved my cheeseif you

explaining change management with who moved my cheese?if you have read the book who move my cheese could you please

  Monetary policy from federal reserve

Describe GDP growth, unemployment, inflation/recession, international trade, currency valuation, fiscal policy government, monetary policy from federal reserve.

  Internet as a source for information

Discuss and explain whether or not the increasing use of the Internet as a source for data, especially among professionals, is effecting the traditional dominance of media power in leading television networks.

  National accounting for foreign exchange

What difference has the introduction of a comprehensive income statement made to U.S. national accounting for foreign exchange?

  What price maximizes net income from sales of the product

The unit cost is known to be $24. What price maximizes net income from sales of the product?- Determining an Optimal Price A firm's Marketing Department.

  Federal appeals court overrules fcc on indenency

Although the First Amendment generally prevents the U.S. government from engaging in censorship, an exception exists for broadcast radio and television.

  Type of system provides to consumers

1. Assume that insurers operate in an environment where price regulation does not exist. a. Describe at least two potential benefits that this type of system provides to consumers. b. Describe at least two potential costs to consumers.

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