lect29-final-rev-notcur - Lecture Notes CMSC 251 HC to HP...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Lecture Notes CMSC 251 HC to HP Reduction bool HamCycle(graph G) { for each edge {u,v} in G { copy G to a new graph G’ delete edge {u,v} from G’ add new vertices x and y to G’ add new edges {x,u} and {y,v} to G’ if (HamPath(G’)) return true } return false // failed for every edge } This is a rather inefficient reduction, but it does work. In particular it makes O ( e ) calls to the Ham- Path() procedure. Can you see how to do it with fewer calls? (Hint: Consider applying this to the edges coming out of just one vertex.) Can you see how to do it with only one call? (Hint: This is trickier.) As before, notice that we didn’t really attempt to solve either problem. We just tried to figure out how to make a procedure for one problem (Hamiltonian path) work to solve another problem (Hamiltonian cycle). Since HC is NP-complete, this means that there is not likely to be an efficient solution to HP either. Lecture 29: Final Review (Tuesday, May 12, 1998) Final exam: As mentioned before, the exam will be comprehensive, but it will stress material since the second midterm exam. I would estimate that about 50–70% of the exam will cover material since the last midterm, and the remainder will be comprehensive. The exam will be closed book/closed notes with three sheets of notes (front and back). Overview: This semester we have discussed general approaches to algorithm design. The goal of this course is to improve your skills in designing good programs, especially on complex problems, where it is not obvious how to design a good solution. Finding good computational solutions to problems involves many skills. Here we have focused on the higher level aspects of the problem: what approaches to use in designing good algorithms, how generate a rough sketch the efficiency of your algorithm (through asymptotic analysis), how to focus on the essential mathematical aspects of the problem, and strip away the complicating elements (such as data representations, I/O, etc.) Of course, to be a complete programmer, you need to be able to orchestrate all of these elements. The
Background image of page 1

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

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 01/13/2012 for the course CMSC 351 taught by Professor Staff during the Fall '11 term at University of Louisville.

Page1 / 3

lect29-final-rev-notcur - Lecture Notes CMSC 251 HC to HP...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online