CPSC 320: Intermediate Algorithm Design and Analysis
Assignment #5, due Monday, March 10th , 2014 at 16:00
This assignment is dierent from the rst four in that you will learn about a randomized data
structure called a skip list, and then answer a few simp
CPSC 320: Intermediate Algorithm Design and Analysis
Assignment #6, due Wednesday, March 26th , 2014 at 16:00
[6] 1. Vancouvers Georgia street has many tall buildings, but only some of them have a clear view
of Stanley Park. Auppose we are given an array
UBC, CPSC 320: Intermediate Algorithm Design and Analysis (Winter 1 2015/2016)
Assignment 7
Due: November 27, 2015 at 3.30p
1. (Amortized Analysis) Recall that a standard queue maintains a sequence of items subject to the following
operations:
Enqueue(x)
CPSC 320: Intermediate Algorithm Design and Analysis
Assignment #1, due Wednesday January 22nd, 2014 at 16:00
[8] 1. As stated in class and proved in the textbook, the stable matching algorithm of Gale and
Shapley gives the best possible results for the s
CPSC 320: Intermediate Algorithm Design and Analysis
Assignment #6, due Wednesday, March 26th , 2014 at 16:00
[6] 1. Vancouvers Georgia street has many tall buildings, but only some of them have a clear view
of Stanley Park. Auppose we are given an array
CPSC 320: Tutorial 1
1. Prove that for all reals a 6= 1,
n
X
ai =
i=0
an+1 1
.
a1
2. Prove that for all reals a and positive integers b,
(n + a)b (nb ).
3. Prove or disprove,
If f (n) O(g(n) then 2f (n) O(2g(n) ).
4. Ask me about the monster problem.
1
CPSC 320: Tutorial 7
1. Consider the problem of determining if a bit string of length n contains two consecutive 0s.
For what integers n must any algorithm that solves this problem examine every bit of a (worst
case) bit string of length n? Why?
2. Run Kr
CPSC 320 Sample Midterm 2
November 2012
Name:
Student ID:
Signature:
You have 50 minutes to write the 5 questions on this examination.
A total of 40 marks are available.
Justify all of your answers.
You are allowed to bring in one hand-written, double-
Practice Midterm 1 (answers on the back)
1. Indicate whether the following statements are True or False. Assume n, f (), g(), and h() are
positive and n is an integer You do not need to give a proof.
n2 O(n3 ).
If f (n) O(g(n) and g(n) O(h(n) then f (n) O
CPSC 320 Sample Midterm 1
October 2010
Name:
Signature:
Student ID:
You have 50 minutes to write the 4 questions on this examination.
A total of 40 marks are available.
Justify all of your answers.
You are allowed to bring in one hand-written, double-s
CPSC 320 Sample Midterm 2
November 2010
Name:
Signature:
Student ID:
You have 50 minutes to write the 5 questions on this examination.
A total of 40 marks are available.
Justify all of your answers.
You are allowed to bring in one hand-written, double-
.EOmtmmEoo w 5 comb 3% Ho: mam 2
0:0: mm 2 new acmEmEoo
36:8 08 was 2: gm 565. 33% an :mmE 9 A o 5533 on: an: 8:58 8: 8%
:oumnmvv 2t 65 Bo Z dmzumE B x we :25: 2t wmnmsnmo nommano 3030 <
.cmbE ENE 5:me 2:? m nocmumm :03 man w
.8233: Ext Shots as? w 8:3me
am (m4 3% ,KJL/jc ~14 m5 " MWN
_.,W._WMW,_ My, #7 VM/ EXQW
\ E8: 11 / 9 30m
A. .5 a. A _ aerwm/m 62/ oww n
WM. _ , . . L SK 200
f eve/7 i/LPL/VL f M SIZE FL. (xv/r914 0 /7mw/
SO/UVL7D7 Value 027(I) "
MnAJes minimizfvij handbs MaXJMM/nj
VAJU Value.
E
Um CL/QUE 23 A/RAMC/ (Q3)
3:239 we Wm: +0 5km. . came 6PM NR?
We knew: he SATP cfw_4% NP=P
(100M COOKS
VTMDreM " , ., , w W v.w~-~M_._,.W~ Mm.
50 ) we ee/A 5M7 Show ) 1C CL l, QUE 6? MW SAT 6 a
I 0W WAS We. wan; +19 $40M; how 43 us<
6L pl a) grxl+km QT CL
(W,
W) Liv/37903: Lt/*6. WM/ 1%) WJ /7/7/?/
OIL.- Wag/g/ /'(ESM-
/3 x a V (j Y E3
I, II / \I
, y k j \
w/ 323/ 73/ j
26 ' J. Ann
wf'Hx sizes S 2
or 0) 20x1, iX/oM we! 393/00.
We 63c; MUS;
A); MUIHPl7/kj fU-Jo WaxLYI'QZS A3 a JLIW
baa/be ~. , )
MAXWXC) k D
Q9999 949999 (4%
L69 TCM [Di % abmmg +9999? aew
4 K Vantage/5 [Aw/e. been Hr-cfw_149A-
L84 dk[uj = Hue, VaJ/U op (JD/4:1 WCOY ME 7,114)
CM 110 meo my any a
$74 AKEH : WWW QorremL
: 00 oWw$e J
ugnpo 9Q dam/x is (WE gum K Hmkon
449m4wvw 44 1
La U: be. Ma
me \j M ,Mm; JV
% )3 +Ca3m3+9 mj Mm [:21
SemLms 22 1 & 23 of Cues
A awn/1% 6' 1: a 56/4 MP VQVIL?CC35 (/ K
(J/
_ nd A 36/1 OVE @ds E g \/X \/
G 2' C v) E) \j @
c, 9 2 3 f E 5' l
EXAM/(e; \/ 1, I /(% [</Z) (13> (/7): 65%.?)
Ede ma7 bad Ifrk (HZ->1] (2, A
O
SmegHCaH7 )5] S n 5 BLn/oj
So.-.
TOW c-m + 7(Ln/501L T(~n_3LV%O_U
I FL 3? > n 3 L%_ : Q, So W 5vEPrDElem.
mist m4 Jacrease
a
W 03 or-IMj M Hm: Cage
TO $ C obw ?
Chm TCH\ d'n 'COY 23! d: 3OL
393$ TM 4 on +TUWH+T<W9>LMOJ>
can + cLLm/sj +- cleBLKDM
5 Ch +w
CPSC 320 Sample Midterm 1
February 2011
Name:
Signature:
Student ID:
You have 50 minutes to write the 5 questions on this examination.
A total of 40 marks are available.
Justify all of your answers.
You are allowed to bring in one hand-written, double-
Masterm Theorem Practice Questions
1. Determine whether or not each of the following recurrence relations can be
solved by applying the Master theorem. Justify why or why not, and in the
cases where the recurrence can be solved, give a bound on the soluti
Practice Midterm 2 (answers on the back)
On the midterm, you may use any algorithm described in class without giving its pseudocode or
re-deriving its running time.
1. Indicate whether the following statements are True or False. You do not need to give a
Solutions to Tutorial #2
Solutions to Sample Problems for Tutorial #2
For the upper bound, we see that S = 1k + 2k + . + (t-1)k + tk tk + tk + . + tk +
t = t * tk = tk+1. Hence S (tk+1).
For the lower bound, we use the trick you saw in class: we drop the