# hw3_s.pdf - Algorithms CSE 101 Homework III Turn in...

This preview shows pages 1–3. Sign up to view the full content.

Algorithms: CSE 101 — Homework III Turn in solutions to problems 8, 14, 22, 24 Problem 1: Alternative minimum-spanning-tree algorithms (CLRS) In this problem, we give pseudocode for three different algorithms. Each one takes a graph as input and returns a set of edges T . For each algorithm, you must either prove that T is a minimum spanning tree or prove that T is not a minimum spanning tree. Also describe the most efficient implementation of each algorithm, whether or not it computes a minimum spanning tree. 1. MAYBE-MST-A ( G, w ) 1 sort the edges into nonincreasing order of edge weights w 2 T E 3 for each edge e , taken in nonincreasing order by weight 4 do if T - { e } is a connected graph 5 then T T - e 6 return T 2. MAYBE-MST-B ( G, w ) 1 T ← ∅ 2 for each edge e , taken in arbitrary order 3 do if T ∪ { e } has no cycles 4 then T T e 5 return T 3. MAYBE-MST-C ( G, w ) 1 T ← ∅ 2 for each edge e , taken in arbitrary order 3 do T T ∪ { e } 4 if T has a cycle 5 then let e 0 be the maximum-weight edge on c 6 T T - { e 0 } 7 return T Solution. Problem 2: Arbitrage (CLRS) Arbitrage is the use of discrepancies in currency exchange rates to transform one unit of a currency into more than one unit of the same currency. For example, suppose that 1 U.S. dollar buys 46.4 1

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern