CSCI 170 Homework #2 Solutions
1. Suppose you have two sets A and B, each with n elements consisting of real numbers in no
particular order. Let C be the Cartesian Product of sets A and B.
(a) Devise
CSCI 170 Homework #2 Solutions
1. Write your name, student ID number, lecture time, and discussion time. Multi-page submissions must be stapled. Failure to complete any of these items will result in d
CSCI 170 Homework #1
Due Date: Monday, September 8th
You may submit in class on the due date, or you may submit in the dropbox (Box 7, in the lobby
of PHE. Upon entering PHE, the boxes are tucked just
CSCI 170 Homework #1 Solutions
1. Write your name, student ID number, lecture time, and discussion time. Multi-page submissions must be stapled. Failure to complete any of these items will result in d
CSCI 170 Homework #5 Solutions
1. Write your name, student ID Number, which lecture you attend (MW morning, MW afternoon, or TTh afternoon), and which discussion section you attend (Mon
4pm, Mon 6pm,
CSCI 170 Homework #5 Solutions
1. Write your name, student ID number, lecture time, and discussion time. Multi-page submissions must be stapled.
2. A military has set up 4 ground stations G1 , G2 , G3
CSCI 170 Homework #7 Solutions
1. Write your name, student ID Number, which lecture you attend (MW morning, MW afternoon, or TTh afternoon), and which discussion section you attend (Mon
4pm, Mon 6pm,
CSCI 170 Homework #6 Solutions
1. Write your name, student ID Number, which lecture you attend (MW morning, MW afternoon, or TTh afternoon), and which discussion section you attend (Mon
4pm, Mon 6pm,
CSCI 170 Homework #1
Due Date: Tuesday, January 28th, 2:30pm
Submit in class or the dropbox (Box 11, rst oor of SAL, opposite the Mens bathrooms).
1. Write your name, student ID Number, which lecture
CSCI 170 Homework #8 Solutions
1. Write your name, student ID Number, which lecture you attend (MW morning, MW afternoon, or TTh afternoon), and which discussion section you attend (Mon
4pm, Mon 6pm,
CSCI 170 Homework #1 Solutions
1. Consider a sequence indicating the cost to produce a constellation of satellites. Let Cn
denote the cost to produce the nth satellite. Assumedly each successive unit
The Runtime of Algorithms
Which of the following algorithm running times has a better growth rate?
10 log100 n or
1
n?
100
n
100n100 or 1.01 100 ?
logc n is O(nd ), for any constants c, d > 0.
In
Number Theory: Primes and Cryptography
The Sieve of Eratosthenes is a method to nd all primes not exceeding some number.
To
nd all primes not exceeding x, note that any such prime must have a prime di
The Runtime of Algorithms
The typical measure of running time is to count the number of operations performed.
What is wrong with this measure?
Suppose we have two algorithms to solve the same proble
What is Discrete Mathematics?
XKCD:
The primary goal of this course is to build problem solving skills which will serve you well
throughout the CSCI curriculum and your career.
How to reason clearly
Propositional Logic
The building block of logic is the proposition: a statement which declares a fact that is either
true or false.
Which of these are propositions?
Yes
No
36 is a prime number.
Spaghe
Proofs
The following are logical fallacies
Arming the Conclusion: p q, q, then p
Denying the Hypothesis: p q, p, then q
Circular Reasoning: The conclusion is q, and you assume that q is true at som
First-Order Logic
Consider the predicate has(x, y), where xs universe is the set of all dogs, and ys universe is
the set of all tails.
Translate the following statements.
xy has(x, y).
yx has(x, y).
Propositional Logic
What does the following statement say, and what do you think it was intended to say? If
you eat your dinner, you will get dessert.
A set of compound propositions are consistent if
Strong Induction
Exam Time: Thursday, Feb. 19th, 5-6:50pm
Location:
If your last name starts with an A, B, C, D, or E: please show up to SSL 150.
Otherwise: please show up to either ZHS 159 or ZHS 163
CSCI 170: Proofs
Related reading: 1.8
Rules of Inference for Quantied Statements
Universal Instantiation
Existential Generalization:
Universal Generalization:
Existential Instantiation:
x P (x), then
CSCI 170: Inductive Proofs
Related reading: 5.1
Let P (n) be the predicate that the following summation is true:
we want to prove that P (n) is true for all integers n > 0.
n
i=1
i=
n(n+1)
.
2
Suppose
Conditional Probability and Independence
A Bernoulli trial is an experiment with two outcomes that do not necessarily have equal
probability (for example, a biased coin). We consider one outcome the s
Counting
How many ways are there to arrange 10 people in a line, where two lineups are considered identical if they are mirror images of each other?
In a version of BASIC, variables can be one or tw
Advanced Counting: Generalized Permutations and
Combinations
A message on a Twitter-like service consists of exactly r characters. Because it is the
internet, people only communicate using capital le
The Pigeonhole Principle
Chess is played on an 8 8 board. The Queen piece can attack any square horizontal,
vertical, or diagonal from it. Prove that if there are 9 queens on the board, two of them ca
Spanning Trees
Given a graph G, a spanning tree is a subgraph of G which is a tree containing every
vertex of G.
Minimum Spanning Tree: Given a connected graph G = (V, E) with edge weights, an MST
is
Trees
An undirected graph is a tree if it is connected and has no cycles.
Any two statements imply the third:
G is connected
G has no cycles
G has n 1 edges.
Weve already talked about graphs. Why s
Elementary Graph Algorithms
Depth-First Search
Given a graph G and two nodes s and t, how could we nd a path from s to t?
For example, how do we nd a path from v1 to v6 in the following graph?
V1
V3
V