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

  Illustrate what should dan say or do now

Evaluate behaviour as a manager and identify effective and ineffective actions. Illustrate what should Dan say or do now?

  Example of empowerment at work

Empowerment and empowering employees is a corporate cultural shift that is slowly working its way into many U.S. companies.  Please share an example of "Empowerment at Work" that you have seen or read about.  Remember to state the company that is ..

  Internal communication issues in a hospitalan ongoing

internal communication issues in a hospitalan ongoing challenge in the delivery of services to customers that we

  Challenges and barriers that impact an organization ability

There are many challenges and barriers that impact an organization's ability to create a culturally diverse workforce, yet one without a high degree of conflict that may arise with individuals of different heritages, perspectives and opinions.

  Midpoint of the downward sloping linear demand curve

Refer to the previous question about total expenditure and the elasticity of demand. Check whether the following statement is true for the demand function in that question: Total revenue is maximized at the midpoint of the downward sloping linear ..

  Analyze the accuracy of the presented numbers

Describe the key financial ratios required for successful investing and analyze the accuracy of the presented numbers. Discuss how you would differentiate your product or service so that it would be considered unique

  Which of the three process based motivation theories

Apply Maslow's hierarchy of needs to a sport organization you are familiar with. - Which of the three process-based motivation theories do you prefer? Why?

  What categories of contract quality requirements

What categories of contract quality requirements in FAR 46.202.

  Variables could lead to different outcomes

What flaws might exist in your calculations, and what variables could lead to different outcomes? What actions could you take ensure you reach your target goal?

  Explain what you learned from this experience

Explain what you learned from this experience. Be sure to comprise citations for quotations and paraphrases with references in APA format and style.

  Define what a patent is and describe a patent duration

Many businesses have patents for their products. Define what a patent is and describe a patent's duration. What are your remedies for patent infringement?

  Responsible for controlling the weight of a box of cereal

As a quality analyst you are also responsible for controlling the weight of a box of cereal. The Operations Manager asks you to identify the ways in which statistical quality control methods can be applied to the weights of the boxes.

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