Definition of the useless function

Assignment Help Business Management
Reference no: EM132103537

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: EM132103537

Questions Cloud

Explain the purpose of the router debug command : ICTNWK506 – Configure, verify and troubleshoot WAN links and IP services - What are two things you can do to manage risks associated with electrical equipment
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.
Seating order that conforms to the above rules : Provide a seating order that conforms to the above rules. An example of an invalid seating order is:
Information ownership and property-rights : How does the practice of storing personal genetic data in privately owned computer databases raise issues affecting information ownership
Definition of the useless function : Below is the definition of the useless function:
What is meant by modular design : What is meant by modular design? How is it implemented in C#?
Discuss the importance of minimum variance portfolios : FIN200 Assignment- Explain how Security Market Line is different from Capital Market Line. Discuss importance of minimum variance portfolios
Recommend that management invests in : List four network tools that you would use to run your network and that you would recommend that management invests in.
Cmit interconnecting cisco devices : How does the work in a CMIT Interconnecting Cisco Devices course align with your career goals?

Reviews

Write a Review

Business Management Questions & Answers

  Develop an analytics-driven organization

In a 250-500 word paper, describe the ways in which the organization you identified has utilized or will utilize the talent and resources to develop an analytics-driven organization.

  Rushworth kidder theory

Using Rushworth Kidder's theory: List 4 dilemmas paradigms (define 1-in your own words) and list 3 resolution principles: (define 1-in your own words). Your definitions must include at least one strength/weakness.

  What type of ownership should ava give

Ava decides to grant one of her houses to her brother but does not want her nephew to inherit the property when her brother dies.

  Disney organizationanalyze the individual values and the

disney organizationanalyze the individual values and the organizations disney values as reflected by the organizations

  Pressing ethical issues surrounding genetic testing

What do you consider the most pressing ethical issues surrounding genetic testing? Provide at least two examples, and explain why you consider these most important.

  Business and corporation law

A shipbuilder had contracted to build a tanker for North Ocean Tankers. The contract was in US dollars and didn't contain any provisions for currency fluctuations. Approximately halfway through construction of the ship, the United States devalued ..

  Describe a time where you felt engaged or appreciated

Describe a time where you felt engaged, included, or appreciated in the task being done. Also, describe a time where you did not feel engaged, included, or appreciated.

  Analyze importance and benefits of using critical thinking

Discuss the importance and benefits of using critical thinking. Relate the importance and benefits of critical thinking to the example provided. Discuss ways you might use critical thinking in your current job or chosen career path.

  Examples of hazardous wastes generated by businesses

In chapter 10, examples of hazardous wastes generated by businesses, industries, and institutions are discussed. Take five (5) of these examples

  What would be your levels of expectancy

Think about the ideal job that you would like to have. Describe this job, the kind of manager you would like to report to, and the kind of organization you would be working in. Answer the following questions: 1. What would be your levels of expect..

  Imperfect distribution of income

In reference to labour markets in professional sports, discuss how players are paid.

  What is the companys annual inventory turns

What is the companys annual inventory turns if the company policy is to target a 99.25 percent in-stock probability?

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