Analyze the running time of the following algorithms asymptotically. (a) Algorithm for-loop1(n): p1 for i 1...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Analyze the running time of the following algorithms asymptotically. (a) Algorithm for-loop1(n): p1 for i 1 to 4√n do р<рхі return p (b) Algorithm for-loop2(n): s0 for 1 to n do for ji to n do s+ s +i return s (c) Algorithm WhileLoop 1(n): x← 0; j← 1; while (j ≤n){ } x + x + 1; j+4j; (d) Algorithm WhileLoo2(n): x < 0; 1 j← n; while (j≥2){ } x ← x + 1; j←j³; (e) Algorithm While Loop3(n): x 0 j← 1 while (j ≤n) for i j to n do x + 1 x j+j+1 return x (f) Algorithm While Loop4(n): x 0 j← 1 while (j≤n) for i 1 toj do x + x + 1 j3 x j return x Analyze the running time of the following algorithms asymptotically. (a) Algorithm for-loop1(n): p1 for i 1 to 4√n do р<рхі return p (b) Algorithm for-loop2(n): s0 for i 1 to n do for ji to n do s+ s +i return s (c) Algorithm While Loop1(n): x← 0; j← 1; while (j ≤n){ } x + x + 1; j+4j; (d) Algorithm WhileLoo2(n): x = 0; 1 j ←n; while (j≥ 2){ } x ← x + 1; j←j³; (e) Algorithm WhileLoop3(n): x 0 j← 1 while (j ≤n) for i j to n do x + 1 x j+j+1 return x (f) Algorithm While Loop4(n): x 0 j← 1 while (j≤n) for i 1 to j do x + 1 x j3 x j return x Analyze the running time of the following algorithms asymptotically. (a) Algorithm for-loop1(n): p1 for i 1 to 4√n do р<рхі return p (b) Algorithm for-loop2(n): s0 for 1 to n do for ji to n do s+ s +i return s (c) Algorithm WhileLoop 1(n): x← 0; j← 1; while (j ≤n){ } x + x + 1; j+4j; (d) Algorithm WhileLoo2(n): x < 0; 1 j← n; while (j≥2){ } x ← x + 1; j←j³; (e) Algorithm While Loop3(n): x 0 j← 1 while (j ≤n) for i j to n do x + 1 x j+j+1 return x (f) Algorithm While Loop4(n): x 0 j← 1 while (j≤n) for i 1 toj do x + x + 1 j3 x j return x Analyze the running time of the following algorithms asymptotically. (a) Algorithm for-loop1(n): p1 for i 1 to 4√n do р<рхі return p (b) Algorithm for-loop2(n): s0 for i 1 to n do for ji to n do s+ s +i return s (c) Algorithm While Loop1(n): x← 0; j← 1; while (j ≤n){ } x + x + 1; j+4j; (d) Algorithm WhileLoo2(n): x = 0; 1 j ←n; while (j≥ 2){ } x ← x + 1; j←j³; (e) Algorithm WhileLoop3(n): x 0 j← 1 while (j ≤n) for i j to n do x + 1 x j+j+1 return x (f) Algorithm While Loop4(n): x 0 j← 1 while (j≤n) for i 1 to j do x + 1 x j3 x j return x
Expert Answer:
Related Book For
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill
Posted Date:
Students also viewed these programming questions
-
7) A blob of clay of mass M is propelled upward from a spring that is initially compressed by an amount d. The spring constant is k. What is the ultimate height h above the unstretched spring's end...
-
Walker is 20 years old and single, lives in a rental house, and has no children. Last year, he earned 53,000 in his internship for KPMB. His wages withheld for federal income where $6,700. In...
-
Give a big-Oh characterization, in terms of n, of the running time of the Loop1 method shown in Algorithm 1.21. Algorithm Loop1(n): s-0 for i + 1 to n do s-s+i Algorithm Loop2(n): p-1 for i - 1 to 2n...
-
The objective of this problem is to design and develop a program for Huffman coding algorithm. The discrete source has an alphabet X = {x1, x2, x3, x4, x5, x6, x7, x8, x9} with corresponding...
-
The gravity wall is made of concrete. Determine the location (xc, yc) of the center of gravity G for the wall. Given: a = 0.6 m b = 2.4 m c = 0.6 m d = 0.4 m e = 3 m f = 1.2 m b.
-
Home Corp sold a machine for $50,000. Home Corp bought the machine for $55,000 several years ago and took $12,500 depreciation on the machine. What is the amount and character of Home Corp in profit...
-
For each of the following situations, calculate the population standard error of the mean \(\sigma \mathrm{X}^{-}\). a. \(\sigma=18 ; N=36\) b. \(\sigma=9.42 ; N=49\) c. \(\sigma=1.87 ; N=60\) d....
-
Effects of Burger Kings Current Liabilities on Its Statement of Cash Flows The following items are classified as current liabilities on Burger King Holdings, Inc.s balance sheets as of June 30, 2008,...
-
What is the total cash collection for April? Q1- the following is information of Royal Company for the quarter ending June 30th Sales budgets for the next four months are: April May June Budget sales...
-
FREE-CASH-FLOWS-BASED VALUATION. In Problem, we projected financial statements for Wal-Mart Stores, Inc. (Walmart) for Years +1 through +5. The data in Exhibits 13 (see pages 985987) include the...
-
1. A company developed a promising product and wants to make decisions. Based on the best available information, a decision tree was drawn. Develop Product Sell Idea Lease for Royalty Produce &...
-
Manahan Corporation received its August 31 bank statement showing total funds on deposit of \($288\),090.09. This amount was \($149\),158.22 in excess of the balance in the general ledger Cash...
-
Morrison Mountain Medical Clinic (MMMC) accepts credit card payments from its patients. Following are the batched transactions for June 11. (1) Total charges on MasterMoney and Wisa credit cards were...
-
Micro Detect Corporation was sued for securities fraud. It was alleged that the company deliberately overstated net income by failing to appropriately recognize losses on its trading securities....
-
Winsloe Corporation obtained an investment in the stock of Southern Rail. The intent of the investment was not to obtain control or to exert significant influence. Winsloe has no plans to trade the...
-
Devol Computing invested in $100,000 of face amount of 6-year bonds issued by Horton Micro Chip Company on January 1, 20X1. The bonds were purchased at 103, and bear interest at a stated rate of 8%...
-
Economists sometimes give conflicting advice because O economists acting as scientists do not like to agree with economists acting as policy advisers. O graduate students in economics are encouraged...
-
Write a program to move a signed number from smaller register to bigger register. Hint: movzx ax, bl Topic: Data Related Operators and Directives in assembly language
-
During the 2012 tax year, Irma incurred the following expenses: Union dues..............................................................$275 Tax return preparation...
-
The following additional information is available for the Dr. Ivan and Irene Incisor family from Chapters 1 and 2. On September 1, Irene opened a retail store that specializes in sports car...
-
During 2012, William purchases the following capital assets for use in his catering business: New passenger automobile (September 30)........................$21,500 Baking equipment (June 30)...
-
If the displacement of an object is 300 m north, what can you say about the distance traveled by the object?
-
Speed is the magnitude of velocity. Is average speed the magnitude of average velocity? Explain.
-
The average velocity of a jogger on a straight track is computed to be +5 km/h. Is it possible for the joggers instantaneous velocity to be negative at any time during the jog? Explain.
Study smarter with the SolutionInn App