1 / 4

COT 5405

COT 5405. Spring 2009 Feb 10, 2009. Problem 1. Find shortest path in following multi stage graph. Problem 2. A substring is palindromic if it is the same whether read left to right or right to left. For instance, ABRACADABRA, has two palindromic substring of length three (ACA and ADA).

Download Presentation

COT 5405

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. COT 5405 Spring 2009 Feb 10, 2009

  2. Problem 1 • Find shortest path in following multi stage graph

  3. Problem 2 • A substring is palindromic if it is the same whether read left to right or right to left. • For instance, ABRACADABRA, has two palindromic substring of length three (ACA and ADA). • Design an O(n2) time algorithm that takes a string of n letters and returns the (length of the) longest palindromic string.

  4. Problem 3 • You have to cut a wood stick into pieces. • Cost of one cut == the length of the stick being cut. • Only make one cut at a time. • It is easy to notice that different selections in the order of cutting can led to different prices. • For example, consider a stick of length 10 meters that has to be cut at 2, 4 and 7 meters from one end. • One can be cutting first at 2, then at 4, then at 7. This leads to a price of 10 + 8 + 6 = 24 because the first stick was of 10 meters, the resulting of 8 and the last one of 6. • Another choice could be cutting at 4, then at 2, then at 7. This would lead to a price of 10 + 4 + 6 = 20, which is a better price. • Find out the minimum cost for cutting a given stick.

More Related