(a) Determine if the following algorithm terminates. If so, prove this using the potential method If...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
(a) Determine if the following algorithm terminates. If so, prove this using the potential method If not, describe an input that would cause the algorithm to run forever. Require: A connected graph G 1: function ALGORITHM (G) 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: Assign every vertex in G the color black Let S be an empty stack Choose an arbitrary vertex v E G and assign it the color red PUSH(S, V) while S is not empty do u ← POP(S) for each neighbor t of u do if t is colored black then if u is colored red then Assign t the color blue else Assign t the color red return True PUSH(S, t) else if t and u have the same color then return False ▷ Pop a node off the stack and assign it to u (b) Run the algorithm on the following graph and compute the value of the potential func- tion you generated for each iteration of the line 6 (the while loop). For line 4, choose A to be the arbitrary vertex. For line 8, start from the lexicographically smallest node if there is a choice of at least two nodes. B IN D A ▷ Push v onto the stack F E (a) Determine if the following algorithm terminates. If so, prove this using the potential method If not, describe an input that would cause the algorithm to run forever. Require: A connected graph G 1: function ALGORITHM (G) 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: Assign every vertex in G the color black Let S be an empty stack Choose an arbitrary vertex v E G and assign it the color red PUSH(S, V) while S is not empty do u ← POP(S) for each neighbor t of u do if t is colored black then if u is colored red then Assign t the color blue else Assign t the color red return True PUSH(S, t) else if t and u have the same color then return False ▷ Pop a node off the stack and assign it to u (b) Run the algorithm on the following graph and compute the value of the potential func- tion you generated for each iteration of the line 6 (the while loop). For line 4, choose A to be the arbitrary vertex. For line 8, start from the lexicographically smallest node if there is a choice of at least two nodes. B IN D A ▷ Push v onto the stack F E
Expert Answer:
Related Book For
Project Management A Managerial Approach
ISBN: 978-0470533024
8th edition
Authors: Jack R. Meredith, Samuel J. Mantel Jr.
Posted Date:
Students also viewed these accounting questions
-
3 4 5 6 7 8 9 10 11 12 13 A 14 Cost of the Asset 15 Life of the Asset in Years 16 Book Value of the Asset after 5 years 17 Depreciable Basis 18 Yearly depreciation 19 After tax Salvage Value in year...
-
Describe three factors that would cause a company to continue doing business in traditional ways and avoid electronic commerce.
-
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 ARASIN22227 17 18 19 20 21 23 24 25 26 1) (2) Sales Price per unit Variable Cost per unit Contribution per unit Contribution Margin Ratio Break Even Point Sales...
-
Social welfare is maximized when O Total social benefits have been maximized O total social costs have been minimized O total social costs equal total social benefits O marginal social costs equal...
-
Algonquin, Inc., reported the following items at December 31, 2012, and 2011: Requirements 1. Compute Algonquins (a) quick (acid-test) ratio and (b) days sales in average receivables for 2012....
-
Computing the standard inner product between two vectors a, b R n requires n multiplications and additions. When the dimension n is huge (say, e.g., of the order of 10 12 , or larger), even...
-
A trade association (or trade group) is an organization that firms in the same industry form to collect and disseminate trade information, offer legal and technical advice, furnish industry-related...
-
Harveys Corporation borrowed $60,000 from the bank on November 1, 2013. The note had a 6percent annual rate of interest and matured on April 30, 2014. Interest and principal were paid in cash on the...
-
Discuss the following topic(s) in the forum and submit proof of your participation in the online discussions: 1) Professional certification and the practising accountants 2) Cost data and managerial...
-
Thomas was raised with an understanding of the fundamental differences between right and wrong. As an adult, he wasn't making enough money to purchase a new car as quickly as he liked. He found out...
-
Want a critical review of the use of social media and it's impact on the shopping behavior of slovak and Italian consumers during covid 19 pandemic These are must include in critical review 1) what...
-
You currently hold a portfolio of three stocks, Delta, Gamma, and Omega. Delta has a volatility of 44%, Gamma has a volatility of 47%, and Omega has a volatility of 48%. Suppose you invest 30% of...
-
Consider an equally weighted portfolio of stocks in which each stock has a volatility of 40%, and the correlation between each pair of stocks is 27%. a. What is the volatility of the portfolio as the...
-
XL Sports is expected to generate free cash flows of $11.2 million per year. XL has permanent debt of $35 million, a tax rate of 37%, and an unlevered cost of capital of 10.4%. a. What is the value...
-
What are the pluses and minuses of corporate location subsidies? Why do politicians like them so much? Would you be surprised to know that many of the 238 cities bidding for Amazons HQ2 offered much...
-
Does traditional one-person-one-vote (1p1v) majority voting allow voters to directly express differences in strengths of preference? Does quadratic voting do any better? Discuss the differences and...
-
There are twelve commercial banks, listed below, in the United States that on December 31, 2020, had over $250 Billion in total assets. If any of these banks failed due to mismanagement, it is highly...
-
Halley's comet travels in an ellipti- cal orbit with a = 17.95 and b = 4.44 and passes by Earth roughly every 76 years. Note that each unit represents one astronomical unit, or 93 million miles. The...
-
Industrial Building, Inc., has two project teams installing virtually identical, 4-story commercial buildings for a customer in two separate cities. Both projects have a planned daily cost of 100 and...
-
How does the control of creative projects differ from the control of ordinary projects?
-
1. How did the laser cutter save Peerless Saw Company when it could not be justified on payback or ROI grounds? 2. Compare the decision Ted faces nowthe 1200-watt laser purchasewith the decision he...
-
Palm Ltd acquired a business that used a large number of assets that worked in combination to produce a product saleable in offshore markets. The assets of the business include a computer program...
-
Cellar Ltd is in the business of bottling wine, particularly for small wineries that cannot afford sophisticated technical equipment and prefer to concentrate on the growing of the grapes. The white...
-
Dr Mosby owned a large house on a sizeable piece of land in Darwin. Dr Mosby was 92 years old and had become incapable of taking care of the large property. He wanted to move into a retirement...
Study smarter with the SolutionInn App