Definition of the useless function

Assignment Help Business Economics
Reference no: EM132110899

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

Questions Cloud

Strategies for dealing with problems : Describe some of the problems that might arise in a group project and suggest one or more strategies for dealing with those problems
Example of an invalid seating order : Provide a seating order that conforms to the above rules. An example of an invalid seating order is:
How does the practice of storing personal genetic data : How does the practice of storing personal genetic data in privately owned computer databases raise issues affecting information ownership and property-rights?
What benefits do local businesses over foreign businesses : Case - Yansha leans on IS to stay competitive. What benefits do local businesses such as Yansha have over foreign businesses
Definition of the useless function : where random(1, n) returns a uniformly distributed random integer in the range 1 . . . n.
What is meant by modular design : What is meant by modular design? How is it implemented in C#?
What Yansha next move be in order to increase its revenue : Case - Yansha leans on IS to stay competitive. What might Yansha's next move be in order to increase its revenue? How might that move be most successfully taken
Installing windows server : Please explain what the difference is with installing Windows server 2016 in a physical, virtual, or cloud environment?
Analyze database indexes : What is the best way to analyze database indexes so that they run in an optimal fashion. Give examples

Reviews

Write a Review

Business Economics Questions & Answers

  Economics assignment

This document contains various important questions and their appropriate answers in the subject field of Economics.

  Demand and supply curves

Economics is the study of the principles governing the allocation of scarce means among competing ends when the objective of the allocation is to maximize the attainment of the ends.

  Long-run perfectly competitive equilibrium for the firm

Evaluate Government intervene and correct this situation?(a) Explain the concept of a concentration ratio. A rise in the price of magarine Explain the impact of external costs and external benefits on resource allocation long-run perfectly c..

  Supply and demand diagrams

Explain each of the following using supply and demand diagrams,  With the use of a graph, explain how these two programs affect cigarette consumption and the price of cigarettes.

  Case study: fisher-price toys

The case study of the Fisher-Price Toys, Inc., a popular case in basic economics and management from the prestigious Harvard Business School.

  Draw the production possibility curve

Draw the production possibility curve and a. Define consumer surplus and producer surplus.

  Tax revenue

The Australian government administers two programs that affect the market for cigarettes

  Maximize total welfare

How many tickets to sell to maximize total welfare.

  Difference between the cv and the ev

The change in consumer surplus (?CS) is not "theoretically" justifiable like the CV and EV but it continues to be the most widely used measure of consumer welfare change. Explain how this can be reconciled

  Depict von neumann-morgenstern utility index u in a diagram

Depict the von Neumann-Morgenstern utility index u in a diagram

  What is the market solution

What is the market solution (market price and quantity) and What is the total surplus of the society under the market solution

  Calculate gross national product and net national product

Calculate gross national product and net national product

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