#
Include Crazy Toys
def can_post_cs(one, two, three, four, five, six, seven, eight, nine, ten):
'(string, string, string, string, string, string, string, string, string, string) ->
bool
Given ten courses (one, two. ten), returns if the student is able to
CSC D18 Fall 2016
Assignment #2
0
Assignment due date: Thursday, Oct. 27, 9am
Hand-in to be submitted at the start of tutorial,
code to be submitted on the mathlab server by the above due date
Student Name (last, first):
Student number:
Student UtorID:
I
CSC D18 Fall 2016
Assignment #4 Advanced Ray Tracing
0
Assignment due date: Thursday, Dec. 1, 11:59pm
Electronic submission on the mathlab server by the above due date
Student Name (last, first):
Student number:
Student UtorID:
I hereby affirm that all th
CSC D18 Fall 2016
Assignment #1
1
Assignment due date: Oct 7, 2016
Hand-in to be submitted at the start of tutorial,
code to be submitted on the mathlab server by the above due date
Student Name (last, first):
Student number:
Stude
CSC D18 Fall 2016
Assignment #3
0
Assignment due date: Wednesday, Nov. 16, 11:59pm
Electronic submission on the mathlab server by the above due date
Student Name (last, first):
Student number:
Student UtorID:
I hereby affirm that all the solutions I provi
Computer Science C73
Scarborough Campus
September 23, 2016
University of Toronto
Solutions for Homework Assignment #2
Answer to Question 1.
a. Suppose
n = 4, w1 = w2 = 1, w3 = w4 = 2, and C = 3. The proposed algorithm will output the set
cfw_1, 2 (sinc
Computer Science C73
Scarborough Campus
September 16, 2016
University of Toronto
Solutions for Homework Assignment #1
Answer to Question 1. We say that a set A of locations for the superboxes covers a set of locations B
of houses if every element of B is
University of Toronto at Scarborough
CSCC37Numerical Algorithms for Computational Mathematics, Fall 2014
Assignment #2: Linear Equations / Systems
Due: November 5, 2014 at 11:59 p.m.
This assignment is worth 10% of your final grade.
Warning: Your electron
CS 370 Fall 2008: Assignment 1
Instructor: Professor Keith Geddes
Lectures: MWF 3:30-4:20 MC 2017
Web Site: UW-ACE
Due: Thu Sep 25, 2008, 5:00 pm, in the Assignment Boxes, 3rd Floor MC
1. Consider the floating point number system F (2, 5, 10, 10) as defin
Computer Science C73
Scarborough Campus
November 5, 2014
University of Toronto
Homework Assignment #4
Due: November 26, 2014, by 9:30 am
(in the drop box for your CSCC73 tutorial section)
Appended to this document is a cover page for your assignment. Fill
University of Toronto at Scarborough
CSCC37Numerical Algorithms for Computational Mathematics, Fall 2014
Assignment #1: Computer Arithmetic / Norms
Due: October 9, 2014 at 11:59 p.m.
This assignment is worth 10% of your final grade.
Warning: Your electron
University of Toronto at Scarborough
CSCC37Numerical Algorithms for Computational Mathematics, Fall 2014
Assignment #3: Nonlinear Equations/FP Iteration
Due: November 21, 2014 at 11:59 p.m.
This assignment is worth 10% of your final grade.
Warning: Your e
University of Toronto at Scarborough
CSC A67/MAT A67 - Discrete Mathematics, Fall 2016
Exercise #3: Logic and Proofs
Due: September 28, 2016 at 11:59 p.m.
This exercise is worth 3% of your final grade.
Warning: Your electronic submission on MarkUs affirms
University of Toronto at Scarborough
CSCA67 / MATA67Discrete Mathematics, Fall 2016
Exercise #5: Induction / Basic Counting
Due: November 4, 2016 at 11:59 p.m.
This assignment is worth 3% of your final grade.
Warning: Your electronic submission on MarkUs
University of Toronto at Scarborough
CSC A67/MAT A67 - Discrete Mathematics, Fall 2016
Exercise #2: Logic and Proofs Solutions
Due: September 21, 2016 at 11:59 p.m.
This exercise is worth 3% of your final grade.
Warning: Your electronic submission on Mark
University of Toronto at Scarborough
CSC A67/MAT A67 - Discrete Mathematics, Fall 2016
Exercise #1: Implication
Due: September 14, extended to September 16 2016 at 11:59 p.m.
This exercise is worth 3% of your final grade.
Warning: Your electronic submissi
University of Toronto at Scarborough
CSC A67/MAT A67 - Discrete Mathematics, Fall 2016
Exercise #4: Indirect Proofs
Due: October 7, 2016 at 11:59 p.m.
This exercise is worth 3% of your final grade.
Warning: Your electronic submission on MarkUs affirms tha
1. (12 pts) Short Answers.
(a) (4 pts) Name any NPcomplete problem.
CNFISAr
(b) (4 pts) State Churchs Thesis.
AVW Q031'ol9cvsuk 4,\&a\".(\|"( Catt (o QMcocLcL
d") a. Tut/1m; Mmolaivd
(c) (4 pts) What does it mean for a verication algorithm to run in polyn
080 063 Midterm Exam
Mar 12, 2012
1 hour and 50 minutes
NAME: 3 0 L U 0 6
Calculators are not permitted (nor would they be useful).
This is cfw_Elosed FdSkrexam;
Ask an invigilator if there is anything that you do not understand completely.
M m, cfw
Two Puzzles
State Transition Perspective
Toss a fair coin until two consecutive heads (HH). What is the
expected number of tosses? (Answer: 6)
Toss coin until HH:
Toss a fair coin until head and then tail (HT). What is the expected
number of tosses? (Answ
Random, Average, Probability
Example of Probability
Some algorithms have terrible worst-case times, but:
Setting: toss a coin twice.
I
on random input, they are fast on average
The set of all outcomes: cfw_HH, HT, TH, TT
I
or, they contain randomizing ste
Disjoint Sets (Union-Find)
Linked List Implementation
Collection of disjoint sets.
I
make-set(x) creates a singleton set containing x
I
find(x): which set x is in now
(What represents a set? Whatever supports asking
find(x) = find(y).)
I
union(S, S0 ) mer
Introduction
(Edge-)Weighted Graph
Many useful graphs have numbers assigned to edges.
Think of: each edge has a price tag.
(Usually 0. Some cases have < 0.)
c
8
b
7
d
2
A weighted (edge-weighted) graph consists of:
9
4
4
a
i
11
e
14
7
8
10
h
1
g
a set of
Introduction
Introduction: Multi-Pop Stack Example
Today we begin studying how to calculate the total time of a
sequence of operations as a whole.
(As opposed to each operation individually.)
Multi-pop stack operations:
Why and when we care:
I
you have an
Hash Tables
Hash Function: Division Method
Assume you can map keys to natural numbers from 0 to m 1.
Call that function h.
Assume each key is an integer.
h(k) = k mod m
Use an array A of length m.
Simple but susceptible to regular patterns in keys (more c
Text Strings
Evolution
Strings are trivial. (Oh are they now?)
Pre-1960: Vary by manufacturers in the US.
Just represent each character by an 8-bit number. Done?
1960s: Converge to two in the US: ASCII (led by Bell) and EBCDIC
(led by IBM). (ASCII will gr
Introduction
Graph (Undirected): Definition
What is common among:
C
I
cities and highways between them
I
computers and network cables between them
I
people and relationships
I
in a board game: a state and legal moves to other states
A
E
B
D
An undirected
Motivation
B-Trees, e.g., (2,4)-Trees
Suppose a block can hold 2t pointers and 2t 1 keys.
Old storage organization:
CPU
RAM
A node can have c children and c 1 keys, t c 2t.
(Root can have c < t.)
disk
slow
Keys are in ascending order: k1 < k2 < < kc1 .
ki
Ordered Dictionary & Binary Search Tree
Binary Search Tree: Definition
Finite map from keys to values, assuming keys are comparable (<,
=, >).
I
insert(k, v)
I
lookup(k) aka find: the associated value if any
I
delete(k)
I
rank(k): k is the ?th smallest ke