1 Page

worksheet5_solution

Course: CS 321, Fall 2009
School: Washington
Rating:
 
 
 
 
 

Word Count: 429

Document Preview

321 CSE Worksheet 321 Informal Solutions Thursday, November 30, 2003 1. procedure mult(n:positive integer,x:integer) if n=1 then mult(n,x) := x else mult(n,x) := x + mult(n-1,x) 2. If n = 1 , then n = nx , and the algorithm correctly returns x . Assume that the algorithm correctly computes kx . To compute (k + 1)x it recursively computes the product of k + 1 - 1 = k and x , and then adds x . By the inductive...

Register Now

Unformatted Document Excerpt

Coursehero >> Washington >> Washington >> CS 321

Course Hero has millions of student submitted documents similar to the one
below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.

Course Hero has millions of student submitted documents similar to the one below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.
321 CSE Worksheet 321 Informal Solutions Thursday, November 30, 2003 1. procedure mult(n:positive integer,x:integer) if n=1 then mult(n,x) := x else mult(n,x) := x + mult(n-1,x) 2. If n = 1 , then n = nx , and the algorithm correctly returns x . Assume that the algorithm correctly computes kx . To compute (k + 1)x it recursively computes the product of k + 1 - 1 = k and x , and then adds x . By the inductive hypothesis, it computes that product correctly, so the answer returned is kx + x = (k + 1)x , which is correct. 3. If n = 0 , then the rst line of the program correctly returns the function value 1. Assume that the program works correctly for n = k . If n = k + 1 , then the else clause is executed, and the value a times power(a,k) is returned. Since the latter is ak by inductive hypothesis, this equals a * ak = ak+1 , which is correct. 4. f (n) = n2 Let P(n) be f (n) = n2 . Basis step: P(1) is true since f (1) = 1 = 12 , which follows form the denition of f. Inductive Step: Assume f (n) = n2 . Then f (n + 1) = f ((n + 1) 1) + 2(n + 1) 1 = f (n) + 2n + 1 = n2 + 2n + 1 = (n + 1)2 . 5. Let P(n) be a + (a + d) + . . . (a + nd) = Basis Step: P(1) is true since a + (a + d) Inductive Step: Assume that P(k) is true. a+(a Then + d)+. . . (a + kd)+(a + (k + 1) d) = (k+1)(2a+kd) +a+(k + 1d) = 1 [2ak + 2a + k 2 d + 2a + 2kd + 2d] = 1 [2ak + 4a + k 2 d + 3kd + 2d] = 2 2 2 1 (k + 2) (2a + (k + 1)d) 2 6. Basis Step: When n = 1 there is one circle, and we can color the inside blue and the (n+1)(2a+nd) . 2 = 2a + d = 2(2a+d) . 2 outside red to satisfy the conditions. Inductive Step: Assue the inductive hypothesis that if there are k circles, the the regions can be 2-colored such that no regions with a common boundary have the same color, and consider a situation with k + 1 circles. Remove one of the circles, producing a picture with k circles, and invoke the inductive hypothesis to color it in the prescribed manner. Then replace the removed circl...

Find millions of documents on Course Hero - Study Guides, Lecture Notes, Reference Materials, Practice Exams and more. Course Hero has millions of course specific materials providing students with the best way to expand their education.

Below is a small sample set of documents:

Washington - CS - 321
CSE 321: Discrete Structures Assignment #6 Due Wednesday, November 19Reading: Rosen, Sections 4.1-4.3, 5.1-5.3, 7.1, 7.4, 7.5. In the 4th edition, these are 4.1-4.5, 6.1, 6.4-6.5). 1. How many strings are there of four lowercase letters that have t
Washington - CS - 321
CSE 321: Discrete Structures Assignment #7 Due Wednesday, November 26Reading: Rosen, Sections 7.1, 7.4, 7.5, and chapter 8. In the 4th edition, these are 6.1, 6.4-6.5 and chapter 7). 1. A deck of 10 cards, each bearing a distinct number from 1 to 1
Washington - CS - 321
CSE 321: Discrete Structures Assignment #8 Due Wednesday, December 3Reading: Rosen, Sections 7.1,7.4, 7.5 and Chapter 8 (In 4th edition, Sections 6.1, 6.4 and 6.5, chapter 7). 1. Determine whether the following relations R on the set of all people
Washington - CS - 321
CSE 321: Discrete Structures Assignment #9 Due Wednesday, December 10Reading: Rosen, Chapter 8 (In 4th edition, chapter 7). 1. p. 555, problem 24 (4th edition, p. 455, problem 18) 2. Describe an algorithm to decide whether a graph is bipartite. 3.
Washington - CS - 522
Lecture 1Introduction to Combinatorial OptimizationOct 1, 2004 Lecturer: Kamal Jain Notes: Atri Rudra1.1 IntroductionCombinatorial Optimization is a broad eld where roughly one tries to optimize an objective function subject to certain constrai
Washington - CS - 522
%!PS-Adobe-2.0 %Creator: dvips(k) 5.90a Copyright 2002 Radical Eye Software %Title: C:/Documents and Settings/KAMALJ/Desktop/notes/note1.dvi %CreationDate: Wed Sep 29 15:50:37 2004 %Pages: 139 %PageOrder: Ascend %BoundingBox: 0 0 596 842 %DocumentFon
Washington - CS - 522
Lecture 1CS522: Advanced AlgorithmsOctober 4, 2004 Lecturer: Kamal Jain Notes: Chris Re1.1 Plan for the weekFigure 1.1: Plan for the week The underlined tools, weak duality theorem and complimentary slackness, are most frequently used in CS. S
Washington - CS - 522
Lecture 3Polar Duality and Farkas' LemmaOctober 8th, 2004 Lecturer: Kamal Jain Notes: Daniel Lowd3.1Polytope = bounded polyhedronLast lecture, we were attempting to prove the Minkowsky-Weyl Theorem: every polytope is a bounded polyhedron, an
Washington - CS - 522
Lecture 4DualityOct 11, 2004 Lecturer: Kamal Jain Notes: Neva Cherniavsky4.1Weak dualityGiven a linear program, write all the equalities with a greater than or equal sign. The constraints can be strict, and you can have two types of variable
Washington - CS - 522
Lecture 5Facility Location AlgorithmOctober 16, 2004 Lecturer: Kamal Jain Notes: Ioannis GiotisWe are given a bipartite graph which represents a set of n facilities F and a set of m locations. An edge from facility i to location j represents the
Washington - CS - 522
Lecture 1CS522: Advanced AlgorithmsOctober 18, 2004 Lecturer: Kamal Jain Notes: Ethan Phelps-Goodman1.1The Min Cost Steiner Forest ProblemIn the last lecture we saw primal-dual schemas for weighted vertex cover and facility location. In this
Washington - CS - 522
Lecture 7Prize Collecting Steiner Forest ProblemOct 23, 2004 Lecturer: Kamal Jain Notes: Neva Cherniavsky7.1Problem descriptionG = (V, E), C : E R+ cost function. : V V R+ (i, j) = (j, i) (i, i) = 0 HG If you don't have a path between i
Washington - CS - 522
<?xml version="1.0" encoding="UTF-8"?> <Error><Code>NoSuchKey</Code><Message>The specified key does not exist.</Message><Key>261fb21cf1036d8059a87a23b20bc52391cc1f7b.ps</Key><RequestId>EC 27044DD96A35F4</RequestId><HostId>yMVsWj3ksHANdngtLf1kWjoyuSl8
Washington - CS - 522
Lecture 8 CSE 522: Advanced AlgorithmsOctober 25, 2004 Lecturer: Kamal Jain Notes: Ning Chen1Prize-Collecting Problem ReviewGiven a graph G = (V, E), a non-negative cost function c : E Q+ , and a non-negative penalty function : V V Q+ , ou
Washington - CS - 522
Lecture 10Dynamic ProgrammingNovember 1, 2004 Lecturer: Kamal Jain Notes: Tobias Holgers10.1Knapsack ProblemWe are given a set of items U = {a1 , a2 , . . . , an }. Each item has a weight wi Z+ and a utility ui Z+ . Our task is to find the
Washington - CS - 522
Lecture 10Euclidean TSP Tree decompositionsNovember 5, 2004 Lecturer: Kamal Jain Notes: Ioannis Giotis1.1 Euclidean TSP continuedIn the last lecture we considered a bounding box of the points L L for L = 4n2 and the resulting grid formed by un
Washington - CS - 522
Lecture 11Minor Graph Theory and the Ellipsoid AlgorithmNov 8, 2004 Lecturer: Kamal Jain Notes: Atri RudraIn the last lecture we saw how the lemma on characterizing the tree width does not generalize to graphs of tree width three and higher. In t
Washington - CS - 522
Lecture 1Solving Linear Programs with the Ellipsoid AlgorithmNovember 12, 2004 Lecturer: Kamal Jain Notes: Chris R e1.1 OverviewRecall from last time: Given a convext set C, C EV (E) = R, a ball B(, ) C and a polytime separation oracle then w
Washington - CS - 522
Lecture 14 CSE 522: Advanced AlgorithmsNovember 15, 2004 Lecturer: Kamal Jain Notes: Ning Chen1Max-FlowIn the last class, we discussed max-flow problem in terms of total-unimodularity. Note that primal has integer optimal solution implies dual
Washington - CS - 522
Lecture 15Minimization of Submodular Functions in Polynomial Time; Edmond's TheoremNov 19, 2004 Lecturer: Kamal Jain Notes: Neva Cherniavsky15.1 Submodular function minimizationf : 2U {i|i is a k-bit integer} |U | = n S, T f (S) + f (T ) f (S
Washington - CS - 522
Lecture 16Submodular Functions and Network CodingNov 22, 2004 Lecturer: Kamal Jain Notes: Atri RudraIn the last lecture we looked at submodular function minimization. We will present a recent result on submodular functions in this lecture and the
Washington - CS - 522
Lecture 17Network Coding BoundsNovember 29th, 2004 Lecturer: Kamal Jain Notes: Daniel Lowd17.1 Network CodingStart with a directed acyclic graph (DAG) with a single sender and many receivers, where each receiver has k-edge connectivity from the
Washington - CS - 522
Lecture 18Lattices and the Shortest Vector ProblemDecember 3, 2004 Lecturer: Kamal Jain Notes: Chris R e18.1 OverviewIn this lecture, we will show first that every lattice has a basis that can be found in a polynomially amount of time from the
Washington - CS - 522
Lecture 19CS522: Advanced AlgorithmsDecember 6, 2004 Lecturer: Kamal Jain Notes: Ethan Phelps-Goodman19.1IntroductionTodays lecture covers the lattice basis reduction algorithm of Lenstra, Lenstra, and Lovasz (LLL). We prove bounds on the si
Washington - CS - 522
Lecture 20 CSE 522: Advanced AlgorithmsDecember 10, 2004 Lecturer: Kamal Jain Notes: Ning Chen Theorem 1 (Jain'04) Given a convex set S, via a strong separation oracle with a guarantee that the set contains a point with binary encoding length , a po
Washington - CS - 322
CSE 322 Autumn Quarter 2003 Assignment 1 Due Friday, October 3, 2003All solutions should be neatly written or type set. All major steps in proofs must be justied. 1. (5 points) This problem involves an application of the Pigeon Hole Principle. Simp
Washington - CS - 322
CSE 322 Autumn Quarter 2003 Assignment 2 Due Friday, October 10, 2003All solutions should be neatly written or type set. All major steps in proofs must be justified. 1. (10 points) This problem is designed to strengthen your ability to prove facts
Washington - CS - 322
CSE 322 Autumn Quarter 2003 Assignment 3 Due Friday, October 17, 2003All solutions should be neatly written or type set. All major steps in proofs must be justified. 1. (10 points) For this problem you will practice converting a NFA to a DFA. Conve
Washington - CS - 322
CSE 322 Autumn Quarter 2003 Assignment 4 Due Friday, October 24, 2003All solutions should be neatly written or type set. All major steps in proofs must be justified. 1. (10 points) In this problem you will study the relationships between prefixes,
Washington - CS - 322
CSE 322 Autumn Quarter 2003 Assignment 5 Due Friday, October 31, 2003All solutions should be neatly written or type set. All major steps in proofs must be justified. 1. (10 points) In this problem you will practice the process of converting a finit
Washington - CS - 322
CSE 322 Autumn Quarter 2003 Assignment 6 Due Friday, November 14, 2003All solutions should be neatly written or type set. All major steps in proofs and algorithms must be justied. 1. (10 points) In this problem you will explore how to convert an am