This preview shows pages 1–19. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: Administration Account forms. I I have some and will hand out after class. I Sign in to class account and register, or else!!! CS70: Lecture 6. Outline. 1. Induction/Recursion 2. Stable Marriage Problem (Notes 4.) Tournament has a cycle of length 3 if at all. Tournament has a cycle of length 3 if at all. Assume the the smallest cycle is of length k . Tournament has a cycle of length 3 if at all. Assume the the smallest cycle is of length k . Case 1: Of length 3. Done. Tournament has a cycle of length 3 if at all. Assume the the smallest cycle is of length k . Case 1: Of length 3. Done. Case 2: Of length larger than 3. p 1 p 2 p 3 p 4 p k Tournament has a cycle of length 3 if at all. Assume the the smallest cycle is of length k . Case 1: Of length 3. Done. Case 2: Of length larger than 3. p 1 p 2 p 3 p 4 p k p 3 p 1 = 3 cycle Contradiction. Tournament has a cycle of length 3 if at all. Assume the the smallest cycle is of length k . Case 1: Of length 3. Done. Case 2: Of length larger than 3. p 1 p 2 p 3 p 4 p k p 3 p 1 = 3 cycle Contradiction. p 1 p 3 = k 1 length cycle! Contradiction! Program to produce a 3 cycle from a tournamant and a cycle. 3Cycle(T,C) p1 = C[1] p2 = C[2] p3 = C[3] Program to produce a 3 cycle from a tournamant and a cycle. 3Cycle(T,C) p1 = C[1] p2 = C[2] p3 = C[3] if beats?(p3,p1,T) return [p1,p2,p3] Program to produce a 3 cycle from a tournamant and a cycle. 3Cycle(T,C) p1 = C[1] p2 = C[2] p3 = C[3] if beats?(p3,p1,T) return [p1,p2,p3] else 3Cycle(T, append([p1,p3],C[4,..])) Induction/Recursion: Cycle in dense graph. Proof outline for cycle in n nodes, n edge graph. Induction/Recursion: Cycle in dense graph. Proof outline for cycle in n nodes, n edge graph. Base Case: A three node three edge simple graph is a cycle. Induction/Recursion: Cycle in dense graph. Proof outline for cycle in n nodes, n edge graph. Base Case: A three node three edge simple graph is a cycle. Induction Step: 1. if vertex incident to one edge, then remove and use induction hypothesis. Induction/Recursion: Cycle in dense graph. Proof outline for cycle in n nodes, n edge graph. Base Case: A three node three edge simple graph is a cycle. Induction Step: 1. if vertex incident to one edge, then remove and use induction hypothesis. 2. Otherwise. Construct a cycle .. walking along unvisited edges until one cycles. This outline can be converted to recursive procedure that finds a cycle. FindCycle(G) This outline can be converted to recursive procedure that finds a cycle. FindCycle(G) if nVertices(G) = nEdges(G) = 3 return vertices(G) Base Case. This outline can be converted to recursive procedure that finds a cycle....
View
Full
Document
This note was uploaded on 02/29/2012 for the course COMPSCI 70 taught by Professor Rau during the Fall '11 term at University of California, Berkeley.
 Fall '11
 Rau
 Recursion

Click to edit the document details