COS 226 Final: COS 226 Princeton Final Spring 12 Solution

23 views4 pages

Document Summary

Final solutions: analysis of algorithms. (a) f (n ) = 1. C a d a c/d b a a c a. We accepted either c or d for nding a longest path from s to t in an edge-weighted digraph. If path is required to be simple (as usual), then it can be solved in exponential time. 1: shortest paths. (a) 5 2 4 8 7 (b) v. 6 10: string sorting. rabid cable table fable sable cache hedge wedge ledge media medic, substring search. Colonial and cottage are at depth 10; cloister, terrace, and tower are at depth 9; Tiger is at depth 8; charter is at depth 7; cannon and quad are at depth 5; cap and. Since colonial and cloister each contain 8 characters, at least one of them will end up at depth 8 or higher. The following order leaves all strings at depth 8 or lower, which is the best possible:

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers

Related Documents

Related Questions