Algorithms
Summer, 2013
1 / 38
What is an algorithm?
I There are many ways to de_ne an algorithm
I An algorithm is a step-by-step procedure for carrying
out a
task or solving a problem
I an unambiguous computational procedure that takes
some
input and gen
Comp 2700 (Discrete Structures) Fall 2016. Problem Set 1.
Submissions: This assignment is due at 11:59 PM on the 7th of September, 2016. Each student must submit his or
her own assignment. Solutions can either be typed in Latex, MSWord or other such word
Comp 2700 (Discrete Structures) Fall 2016. Lab 3.
Submissions: This assignment is due at 11:59 PM on the 14th of November, 2016. Each student must submit his or
her own assignment. This is a programming assignment. You have to submit code that can be run
Solutions to PS1.
Problem 1 [5 + 5 pts]: Construct the truth table for the following compound propositions:
(a) (p q) (p q)
(b) (p q) r) s
Solution:
(a)
p
F
F
T
T
q
F
T
F
T
pq
T
F
F
T
p q
F
T
T
F
(a)
p
F
F
F
F
F
F
F
F
T
T
T
T
T
T
T
T
q
F
F
F
F
T
T
T
T
F
F
Comp 2700 (Discrete Structures) Fall 2016. Problem Set 4.
Submissions: This assignment is due at 11:59 PM on the 19th of October, 2016. Each student must submit his or her
own assignment. Submit a hard copy - either typed or printed, but I should get a ph
Comp 2700 (Discrete Structures) Fall 2016. Problem Set 5.
Submissions: This assignment is due at 11:59 PM on the 31st of October, 2016. Each student must submit his or her
own assignment. Submit a hard copy - either typed or printed, but I should get a ph
import java.util.*;
import java.io.*;
public class Matrices
cfw_
public static void main(String[] args) throws IOException
cfw_
File data = new File("data2.txt"); / The input file data.txt is located in the same folder as this BlueJ project.
Scanner i
COMP 2700
Spring 2016
Lab 1
Due Thursday, Feb. 11th
0. You may choose to work with one other student enrolled in your COMP 2700 class on this assignment if you wish. If
you do, the project only needs to be submitted to the dropbox once. But be sure to inc
/*
* Write a description of class Sorting here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Sorting
cfw_
public static void insertionSort(int[] a)
cfw_
for (int i = 1; i < a.length; i+) cfw_
int numToInser
Comp 2700 (Discrete Structures) Fall 2016. Lab 1.
Submissions: This assignment is due at 11:59 PM on the 14th of September, 2016. Each student must submit his or
her own assignment. This is a programming assignment. You have to submit code that can be run
Comp 2700 (Discrete Structures) Fall 2016. Solutions to PS2.
Problem 1[10 pts]: If functions f and f g are one-to-one does it follow that g is one-to-one? If your answer is Yes
give a proof, otherwise give a counterexample.
Solution: Yes the function g is
Counting
Arthur G. Werschulz
Summer, 2013
1 / 40
Why talk about counting in a college-level course?
I Counting isn't as easy as it looks.
I Simple sets: trivial to count.
I Complicated sets: hard to count.
I Facebook FOAF.
I Number of ways to _ll a commit
Sets
Arthur G. Werschulz
Department of Computer and Information Sciences
Summer, 2013
1 / 31
Outline
I Basic defnitions
I Naming and describing sets
I Comparison relations on sets
I Set operations
I Principle of Inclusion/Exclusion
2 / 31
Sets
I Set: a co
Arthur G. Werschulz
Department of Computer and Information Sciences
Summer, 2013
1 / 21
Outline
I Finding patterns
I Notation
I Closed form
I Recursive form
I Converting between them
I Summations
2 / 21
Sequences: Finding patterns
What number comes next?
CISC 1100: Structures of Computer Science
Chapter 0
Introduction
Arthur G. Werschulz
Summer, 2013
1 / 30
Welcome to CISC 1100!
I A computer science course, seasoned with a soup_con of math.
I Counts towards the mathematical and computational
reasoning req
Functions
Arthur G. Werschulz
Summer, 2013
1 / 64
Why functions?
I Sets: rigorous way to talk about collections of objects
I Logic: rigorous way to talk about conditions and
decisions
I Relations: rigorous way to talk about how objects can
relate
to each
Logic
Arthur G. Werschulz
Fordham University Department of Computer and
Information Sciences
Summer, 2013
1 / 49
Logical (or illogical?) reasoning
I Is this a valid argument?
I All men are mortal.
I Socrates is a man.
I Therefore, Socrates is mortal.
Vali
Probability
Summer, 2013
1 / 49
Why study probability?
Want to know the likelihood of some event:
I Getting a \head" when ipping a coin (should be 12
)
I Getting at least two \heads" when ipping a coin four
times
I Getting 3 when rolling a six-sided die (
Relations
Arthur G. Werschulz
Department of Computer and Information Sciences
Summer, 2013
1 / 34
Why relations?
I Sets: rigorous way to talk about collections of objects
I Logic: rigorous way to talk about conditions and
decisions
I Relations: rigorous w
COMP 2700
Spring 2016
Lab 2
Due Thursday, March 3rd
0. You may choose to work with one other student enrolled in your COMP 2700 class on this assignment if you wish. If
you do, the project only needs to be submitted to the dropbox once. But be sure to inc