copyright 2011 Oda_Eagle Production, all right reserved
CS115/116/125/134/135/136/2*/3* Private Tutor Email: [email protected]
UWaterloo CS116 Final Exam Question Pack
last update April 4th, 2011
Note: there is no solution come with this question pack,
CS116 Midterm (SCHEME) Natasha Park
CS Midterm Review
Polymorphism: flexibility in the type of arguments; polymorphic function has contract with
variables
Structures
1. construction function (make-name etc)
2. selector function (name-field etc)
3. type pr
CS 116 final (PYTHON) Natasha Park
CS Final Exam Review
General
= is the assignment operator becomes
Assignment statements dont produce a value, they only have an effect
Print does not produce a value, but has an effect
Numbers are either an int or a
MATH 311 Linear Methods II
Chapter 2
General Vector Spaces
Section 1: Properties of a Vector Space
Lecture notes by Karen Seyffarth
University of Calgary
Page 1/16
What is a vector space?
Definition 1
Let V be a nonempty set of objects (elements) with two
MATH 311 Linear Methods II
Chapter 4
Orthogonality
Section 4: Positive Definite Matrices
Lecture notes by Karen Seyffarth
University of Calgary
Page 1/12
Positive Definite Matrices
Definition 1
An n n matrix A is positive definite if it is symmetric and h
MATH 311 Linear Methods II
Chapter 3
Linear Transformations
Section 3: Isomorphism and Composition of Linear
Transformations
Lecture notes by Karen Seyffarth
University of Calgary
Page 1/27
What is an isomorphism?
Example 1
P1 = cfw_ax + b | a, b R, has a
MATH 311 Linear Methods II
Chapter 4
Orthogonality
Section 2: Orthogonal Diagonalization
Lecture notes by Karen Seyffarth
University of Calgary
Page 1/21
Orthogonal Matrices
Definition 1
An n n matrix A is a orthogonal if its inverse is equal to its trans
MATH 311 Linear Methods II
Chapter 5
Linear Transformations and Matrices
Section 1: The Matrix of a Linear Transformation
Lecture notes by Karen Seyffarth
University of Calgary
Page 1/20
Coordinate Isomorphism
Definition 18 (Chapter 3, section 3)
Let V be
MATH 311 Linear Methods II
Chapter 2
General Vector Spaces
Section 4: Finite Dimensional Vector Spaces
Lecture notes by Karen Seyffarth
University of Calgary
Page 1/27
An earlier result from Rn
Theorem 25 of Chapter 1, Section 2
Let U be a subspace of Rn
MATH 311 Linear Methods II
Chapter 4
Orthogonality
Section 3: Singular Value Decomposition
Lecture notes by Karen Seyffarth
University of Calgary
Page 1/14
Singular Value Decomposition (SVD)
Definition 1
Let A be an m n matrix. The singular values of A ar
# Dictionaries #
# Dictionaries are conceptually a collection of key-value pairs. In CS 115 we
# stored those as an Association List and as a Binary Search Tree. In CS 116 we
# don't talk about how they are stored (Hash Table) but we just discuss how
# to
#
# LISTS (and strings)
s = "Throw some perm on your attitude"
# split function builds a list of strings
# by default it splits at whitespace
s.split()
# you can change this by specifying what to split at
s.split('o')
# it can be more than just a single c
#
# COMPARISON CHECKS
# they're mostly the same as Racket except
# a = b for equality testing
# a != b for not equal to
# some examples
3 < 2
4 != 5
"Zelda" != "zelda"
100 >= 101
5 = 5
0.3 = 0.1 + 0.1 + 0.1 #be careful here. Floats will mess with you
'a'
# Accumulative Recursion #
# The idea of accumulative recursion is likely one that you already discovered
on your own
# In its most general form it is basically the idea of "using a helper function
with extra
# parameters. In class I called the extra para
# SEARCHING #
# Searching for whether an item exists in a typical, unsorted list, is generally
# a straightforward process.
def linear_search(L,target):
for val in L:
if val = target:
return True
return False
#
#
x
#
#
This has a worst case of O(n), eithe
#
# STRING OPERATIONS
s = "Donkey"
t = "Kong"
print(s+t)
print(t+s)
print(s*2)
print(s*3)
# print(s*3.0) #ERROR, can't do Str * Float
print(3*s*2)
print(3*s+t) # multiplication takes precedence
print(3*(s+t)
# Note that in all of the above s and t don't c
# FILE INPUT AND OUTPUT #
# using files has various benefits
# - reading files is good for repetitive tasks
# - writing to files is good for storing info for later use
# - writing is also good for sharing with another program
# CREATING A FILE ON YOUR SYS
import check
#
# Python has recursion depth problems.
# Loops are an easy way to repeatedly perform a task.
# There are 2 kinds of loops:
#
# for loops
#
# while loops
#
# A while loop can do anything a for loop can but not vice versa (at least not
# in a
MATH 311 Linear Methods II
Chapter 3
Linear Transformations
Section 1: Properties of Linear Transformations
Lecture notes by Karen Seyffarth
University of Calgary
Page 1/23
What is a linear transformation?
Definition 1
Let V and W be vector spaces, and T
MATH 311 Linear Methods II
Chapter 4
Orthogonality
Section 1: Orthogonal Complements and Projections
Lecture notes by Karen Seyffarth
University of Calgary
Page 1/29
Review
Definition 1 (Orthogonality)
Let ~x , ~y Rn . We say the ~x and ~y are orthogonal
CS 116 Fall 2014
Assignment 02
Due: Tuesday, September 30, 2014 at 5:00 p.m.
Read the restrictions for each question carefully. In some cases, solutions may include recursion, in other cases you
will be ex
CS 116 Fall 2014
Assignment 03
Due: Tuesday, October 7, 2014 at 5:00 p.m.
This assignment is testing your knowledge and understanding of accumulative recursion. Each main function must
have at least one local h
CS 116 Fall 2014
Assignment 04
Due: Tuesday, October 14, 2014 at 5:00 p.m.
You are expected to use the design recipe when writing functions from scratch, including helper functions. There is
a version of the
CS 116 Fall 2014
Assignment 05
Due: Tuesday, October 21, 2014 at 5:00 p.m.
All solutions are in Python.
You are expected to use the design recipe when writing functions from scratch, including helper functio
CS 116 Fall 2014
Assignment 06
Due: Tuesday, November 4, 2014 at 5:00 p.m.
All solutions are in Python.
All test data will match the restrictions described in the question, this includes the data provided by standard input.
In
CS 116 Fall 2014
Assignment 07
Due: Tuesday, November 11, 2014 at 5:00 p.m.
All solutions must use generative recursion in a non-trivial way.
All solutions are in Python.
All test data will match the restrictions described i
Module 01: Introduction to
Programming in Python
Topics:
Course Introduction
Introduction to Python basics
Readings: ThinkP 1,2,3
CS 116 Spring 2017
1: Introduction to Programming in Python
1
Finding course information
https:/www.student.cs.uwaterloo.ca/~
Module 3: Strings and
Input/Output
Topics:
Strings and their methods
Printing to standard output
Reading from standard input
Readings: ThinkP 8, 10
CS116 Spring 2017
3: Strings and Input/Output
1
Strings in Python:
combining strings in interesting ways
s
Module 05: Types of recursion
Topics:
Review of purely structural recursion
Accumulative recursion
Generative recursion
Readings:ThinkP 5.8-5.10, 6.5-6.7
CS116 Spring 2017
05: Types of recursion
1
Review: Structural Recursion
Template for code is based o
Module 07: Efficiency
Topics:
Basic introduction to run-time
efficiency
Analyzing recursive code
Analyzing iterative code
CS116 Spring 2017
07: Efficiency
1
Consider the following two ways to calculate the
maximum of a nonempty list.
Why is one so much