Give an efficient greedy algorithm that finds an optimal vertex
cover of a tree in linear time.
In a vertex cover we need to have at least one vertex for each
edge.
Every tree has at least two leaves, meaning that there is
always an edge which is adjacent
CS 341: Foundations of Computer Science II
Prof. Marvin Nakayama
Homework 13 Solutions
1. The Set Partition Problem takes as input a set S of numbers. The question is
whether the numbers can be partitioned into two sets A and A = S A such
that
X
X
x=
x.
x
Today:
Linear Programming (cont.)
COSC 581, Algorithms
April 8, 2014
Many of these slides are adapted from several online sources
Reading Assignments
Todays class:
Chapter 29.3, 29.5
Reading assignment for next Thursdays class:
Chapter 29.4
Recall: F
15-251: Great Theoretical Ideas In Computer Science
Recitation 7 Solutions
Integer Set Reductions
Definition reminder: Reducing problem A to problem B means giving an algorithm such that if we can
solve problem B in polynomial time, we can solve problem A
Saket Ati
125004084
CSCE 629 Algorithms
Homework 13
34.5-5 The set-partition problem takes as input a set S of numbers. The question is whether the
numbers can be partitioned into two sets and =
such that = . Show that
the set-partition problem is NP-com
Introduction to Algorithms
Massachusetts Institute of Technology
Professors Erik Demaine and Shafi Goldwasser
May 14, 2004
6.046J/18.410J
Handout 26
Problem Set 8 Solutions
This problem set is not due and is meant as practice for the final. Reading: 26.1,
Introduction to Algorithms
Massachusetts Institute of Technology
Professors Erik Demaine and Shafi Goldwasser
December 8, 2002
6.046J/18.410J
Handout 32
Problem Set 8 Solutions
Problem 8-1. Arbitrage and Exchange Rates
This problem is analagous to the var
COMP 789: Selected Topics in CS Mostly NP-Completeness
CMU Phillip Rogaway and Sanpawat Kantabutra
Handout PS #3S
12 Sep 2004
Problem Set 3 Solutions
Problem 6: Reductions when the left-hand-side is in P. Let B be a nontrivial language (meaning that B 6=
Discrete Maths for Computing
Practice 6
Answers
Fall 2014
Dr. Rouba Badra
Chapter 1: Counting
1. Basic Principles of Counting
Exercise 1: We use product rule for 4 tasks where each task consists of assigning one of
the 26 English letters: 264 = 456976.
Th
CHAPTER 2
FUNDAMENTALS OF LOGIC
Section 2.1
The sentences in parts (a), (c), (d), and (f) are statements.
The statements in parts (a), (c), and (f) are primitive statements.
Since p -+ q is false the truth value for p is 1 and that of q is 0. Consequently
MATH 190
Fall 2014
R.I.T Dubai
Discrete Mathematics for Computing MATH190
Homework 2 Due Date: Wednesday December 17th 2014
Student Name:
Exercise 1: Let : be a function defined by
+ 5,
() = cfw_ 2 ,
4 1,
0
0<2
2
a) Find 1 (cfw_1), 1 (cfw_6).
b) Find 1 (
Discrete Mathematics for Computing
Fall 2014
Modular Arithmetic
1. Basic Properties of Modular Arithmetic
Exercise 1: Suppose that and are integers, 4 (mod 13), 9 (mod 13). Find the integer
with 0 12 such that
a. 9 (mod 13)
b. 11 (mod 13)
c. + (mod 13)
d
Discrete Mathematics for Computing
Fall 2014
Chapter 1: Counting
1. Basic Principles of Counting
Exercise 1: High school faculties are to be issued special coded identification cards that consist of four
letters of the English alphabet. How many different
Discrete Mathematics for Computing
Fall 2014
Chapter 1: Counting
3. Binomial Coefficients
Exercise 1: Find the expansion of ( + )4
Exercise 2: What is the coefficient of 2 10 in the expansion of ( + )12 ?
Exercise 3: What is the coefficient of 4 6 in the
MATH 190
Fall 2014
Textbook: R. Grimaldi, Discrete and Combinatorial Mathematics: An
Applied Introduction, Pearson. Fifth Edition
Week 2
Chapter 2: Fundamentals of Logic
Dear Students,
In order to understand and improve your skills in the topics covered i
MATH 190
Fall 2014
Textbook: R. Grimaldi, Discrete and Combinatorial Mathematics: An
Applied Introduction, Pearson. Fifth Edition
Week 1
Chapter 2: Fundamentals of Logic
Section 2.1 Basic Connectives and Truth Tables
Dear Students,
In order to understand
MATH 190
Fall 2014
Textbook: R. Grimaldi, Discrete and Combinatorial Mathematics: An
Applied Introduction, Pearson. Fifth Edition
Week 4, 5
Chapter 2: Fundamentals of Logic
Dear Students,
In order to understand and improve your skills in the topics covere
Virtual Memory
Adapted from lecture notes of Dr. Patterson and
Dr. Kubiatowicz of UC Berkeley
View of Memory Hierarchies
Thus far
cfw_
cfw_
Next:
Virtual
Memory
Regs
Instr. Operands
Cache
Blocks
Upper Level
Faster
L2 Cache
Blocks
Memory
Pages
Disk
Files
T
Arithmetic I
CPSC 350
E. J. Kim
Any Questions?
What happened so far?
We learned the basics of the MIPS
assembly language
We briefly touched upon the
translation to machine language
We formulated our goal, namely the
implementation of a MIPS processor.
1. A palindrome is a string that reads the same forwards and backwards. Suppose we are
given a string S = s.szsssn. and we want to ﬁnd the longest palindrome that can be
formed by deleting zero or more characters from the string.
2 When their respective s