For the following questions, simplify and express your answer as e(n) or (n* (log n)) wherever...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
For the following questions, simplify and express your answer as e(n) or (n* (log n)) wherever possible. If the running time is exponential, then just give exponential lower bounds. Random(n) generates a random number between 1 and n with uniform distribution (every integer between 1 and n is equally likely.) 2. (10 points) Consider the following function: func2(A, n) /* A is an array of integers 1 if (n 28 0; 50) then return (0); 3 for in 1 to [n/2] do 4 5 for is 1 to [n/2] do for is 1 to n do " 6 for is 1 ton do . Alio] Aliol+Alio+is] - Alia] Alix: " 8 9 end 10 end 11 end 12 end 13 Random(15n/7]; 14++func2(A, k); 15 return (s); Random([5n/7]) in Step 11 generates a random number between 1 and [5n/7]. (a) What is the asymptotic worst case running time of func2? Justify your solution. (b) What is the asymptotic expected running time of func2? Justify your solution. For the following questions, simplify and express your answer as e(n) or (n* (log n)) wherever possible. If the running time is exponential, then just give exponential lower bounds. Random(n) generates a random number between 1 and n with uniform distribution (every integer between 1 and n is equally likely.) 2. (10 points) Consider the following function: func2(A, n) /* A is an array of integers 1 if (n 28 0; 50) then return (0); 3 for in 1 to [n/2] do 4 5 for is 1 to [n/2] do for is 1 to n do " 6 for is 1 ton do . Alio] Aliol+Alio+is] - Alia] Alix: " 8 9 end 10 end 11 end 12 end 13 Random(15n/7]; 14++func2(A, k); 15 return (s); Random([5n/7]) in Step 11 generates a random number between 1 and [5n/7]. (a) What is the asymptotic worst case running time of func2? Justify your solution. (b) What is the asymptotic expected running time of func2? Justify your solution.
Expert Answer:
Answer rating: 100% (QA)
Question a What is the asymptotic worst case running time of func2 Solution The asymptotic worstcase ... View the full answer
Related Book For
Organizational Behaviour Concepts Controversies Applications
ISBN: 978-0132310314
6th Canadian Edition
Authors: Nancy Langton, Stephen P. Robbins, Timothy A. Judge, Katherine Breward
Posted Date:
Students also viewed these programming questions
-
Marissa and Dan have decided that the company should use a firm commitment offering with Crowe & Mallard as the lead underwriter. The IPO will be for $85 million. Ignoring underpricing, how much...
-
In 2020, Jos purchased a house for $197,400. He used the house as his personal residence. In September 2023, when the fair market value of the house was $311,800, he converted the house to rental...
-
When the fiscal year ends for a company, it is important to analyze how the company is performing to determine if there are issues to work on and successes to expand on. As the owner of your Sales...
-
Increasingly sophisticated communications technology is allowing more people to work at home. What effect do you think this might have on land-use patterns, specifically the density of residential...
-
An elevator (mass 4850 kg) is to be designed so that the maximum acceleration is 0.0680g. What are the maximum and minimum forces the motor should exert on the supporting cable?
-
How long will it take $10,000 placed in a savings account at 10% interest to grow into $15,000? Please show your calculations.
-
Explain synchronous and asynchronous communication in relation to elearning.
-
What were some of the reasons for the decline in the import-substituting industrialization strategy in favor of a strategy that promotes open trade?
-
Find the units digit of 329 +1112 +15. modulus n, an
-
Franchise taxes are levied on businesses that gain a franchise right of doing business in a jurisdictions territory. The data in Table 9.1 are franchise tax revenues in the city of Sunbelt, Florida,...
-
Toni gets utility from two goods, xl and x2. Let xi (P, P2, I) and xf (P, P2,U) be the compensated and uncompensated demand functions for x1, respectively. Define the income elasticity of demand for...
-
Jillian Mitchell is a citizen and resident of Canada. She applies for a position as a film editor at the California offices of Film Company. Although she is highly qualified for the job, she is not...
-
Harold, a board member of a Fortune 500 corporation, has just discovered at a board meeting that the company will acquire a competitor and that the company stock will likely increase once this...
-
When a child loses a baby tooth, an old U.S. tradition is for the tooth to be put under the childs pillow, so that the tooth fairy will leave money for it. A survey by a Northwestern University...
-
Cameron Garrison served as CEO of Garrison Enterprises, Inc. (GEI), which sold software for health and restaurant inspections for 10 years. During that time, Garrison stopped remitting payroll taxes...
-
Helen, a Hollywood actress, was required to do a dangerous stunt for an adventure movie. She insisted that a stunt actress perform the dangerous stunt, but the director wanted a close-up shot of...
-
Go to Toyota's "Toyota Global Vision". Mission and Vision Statements are usually quite concise and, by extension, tend to reflect the broad beliefs of the company (for example, Energizer Canada's...
-
Suppose the S&P 500 futures price is 1000, = 30%, r = 5%, = 5%, T = 1, and n = 3. a. What are the prices of European calls and puts for K = $1000? Why do you find the prices to be equal? b. What...
-
Explain the difference between hygiene factors and motivators in Herzberg's motivation-hygiene (two-factor) theory?
-
Using the concept of channel richness, give examples of messages best conveyed by email, by face-to-face communication, and on the company bulletin board.
-
Ineffective communication is the fault of the sender. Do you agree or disagree? Discuss.
-
Continuing to focus on evidence associated with the act, concealment, and conversion, use the evidentiary material to continue the examination. In addition, the examiner also starts to think of terms...
-
Consider the following cash flow profile and assume MARR is 10 percent/year. a. Determine the ERR for this project. b. Is this project economically attractive? EOY 0 2 3 4 5 6 NCF -$100 $15 $15 $15...
-
Quilts R Us (QRU) is considering investing in a new patterning attachment with the cash flow profile shown in the table below. QRU's MARR is 13.5 percent/year. a. What is this investment's external...
Study smarter with the SolutionInn App