CIS 275 (Discrete Mathematics)
LAB PROJECT 1 Source Code in Python
> import cmd class interface(cmd.Cmd): def prompt(mySet): print "Please enter the type number for function you would like to choose"\ " %c to %c:\n 1 for one to one\n 2 for onto\n 3
The first box purchased will always contain one of the coupons. For each subsequent box, there
is a
(n-1)/n
chance that the coupon found will be different than the first, and since it follows a geometric
distribution, the expected number of boxes that mus
Algebraic Methods in Combinatorics
Instructor: Benny Sudakov
Assignment 4
To be completed by November 25
Solution of every problem should be no longer than one page!
Problem 1: Let G be a graph with adjacency matrix A.
(a) Show that the (i, j) entry of Ak
Lecture 19
8.5: Representations of Graphs
Example 8.5.2 Adjacency Graph
a b
c
d
graph
a b c d
a
b
c
d
e
e
0
1
0
1
0
1
0
1
0
1
0 1
1 0
0 1
1 0
1 0
0
1
1
0
0
=A
e
adjacency matrix
Adjacency matrix: V x V
A, A2 , A3 ,
A2 = A * A =
0 1 01 0
0 1 01 0
1 0 1 01
Lecture 9
5.2
Representation of Integers and
Integer Algorithms
Number Systems
USERS
CPU
HARDWARE
decimal numbers
hexadecimal
numbers
binary numbers
number Systems as polynomials
Decimal number
(3854)10 = 3*103 + 8*102 + 5*101 + 4*100
Binary number
(10101
Lecture 12
6.2 Permutations and Combinations
DEF. Permutations
A permutation of n distinct elements x1 , , xn is
an ordering of the n elements x1 , , xn .
Example 6.2.1 There are 6 permutations of
A,B,C.
ABC, ACB, BAC, BCA, CAB, CBA
Theorem 6.2.3
There
Lecture 20
Chap. 9
Trees
TREES
DEF: A tree is a simple graph in which there is a
unique path between every pair of vertices.
a
b
f
c
g
ROOT
d
level 0
e
level 1
i
level 2
j
level 3
The height of a tree is the maximum level number.
i is the parent of j.
j i
Lecture 23
Chapter 11
Boolean Algebras and Combinational
Circuits
A Computer System
HumanHuman
users
System software
hardware
bit
Logical Operations on Boolean Variables. A
Boolean variable takes on 0 or 1 (false or true)
AND
0
1
0
0
0
1
0
1
XOR
0
1
0
0
1
Lecture 16
7.3: Applications to Algorithm
Analysis
Algorithm 7.3.1. Selection Sort
Void sort (int *A, cont int n)
/* sort the n integers in ascending order
For (int i+0; i<n; i+)
O(n)
O(n 2 )
cfw_ int j = i;
for int k=i+1; k < n; k+)
O(n)
if (A[k] < A[j])
Lecture 11
Chapt. 6 Counting Methods
6.1. Basic Principles
Example Fig. 6.1.1
Appetizers
Nachos
Salads
Main Courses
hamburger
Cheeseburger
Fish filet
Beverages
tea
milk
coke
root Beer
Ex 6.1.1:Multiplication Rule
How may dinner choices do you have if you
1. If there are m people and n different birthdays, then the probability that all
m people have different birthdays is:
Tex code: (1-1/n)* (1-2/n)*(1-3/n) . (1-(m-1)/n) = \prod_cfw_j=1^cfw_m-1 (1-(j/n)
Actual Equation:
From the hint, we can say:
1-(j/n) <