Solutions for CAS 702 Midterm 2007
Problem 1a Let kj and ij be the values of k and i respectively after statement i := i i is executed j times. Then we observe that i0 = 2, k0 = 1 j +1 j +1 j n, or and ij = 22 , kj = i2 = 22 . The loop ends when kj = 22 j

MARK VILLA VIDAD
400102400
Assignment No.3
Sunday, February 19, 2017
1:31 PM
1. For the recursive relation T(n) = 3T(n/2) + n2 , describe the running time using a big- Theta representation.
Solution:
We have a =3, b=2, and f(n) = n2 . Thus, nlog23 = O(n1.

D ATA STRUCTURES I, II, III, AND IV
I.
Amortized Analysis
II.
Binary and Binomial Heaps
III. Fibonacci Heaps
IV. Union-Find
Lecture slides by Kevin Wayne
http:/www.cs.princeton.edu/~wayne/kleinberg-tardos
Last updated on 2/4/16 5:09 AM
Data structures
Sta

CAS 702 Data Structures and Algorithms Final Exam 60p December 14, 2007 duration of the exam: 3 hours Name: Student Number: Signature:
Problem 1
a. Prove or disprove the following: f (n) = (f (n/2). 5p b. Consider the following: An array of n numbers cont

CAS 702 Final Exam Solution December 2007 1a. False. Let f (n) = 22n . Then f (n/2) = 2n and we cannot nd a constant c such that 22n c2n . 1b. True. Use bucket sort, which is not comparison based, or any similar idea that works. 1c. True. If a node has tw

CAS 702 Data Structures and Algorithms Final Exam 60p December 8, 2008 duration of the exam: 3 hours Name: Student Number: Signature:
Problem 1
a. Prove that (lg n)b = O (na ) where a and b are strictly positive constants. 5p b. Show how can the output of

CAS 702 Data Structures and Algorithms
Midterm Exam - 30 points, 4 problems, 2 pages October 11, 2007 Justify your answers
Name:
Student number:
Signature:
Problem 1
a. Find a theta notation, i.e. (.), for the number of times the statements i = i + i is e

Solutions for CAS 702 Midterm 2007
Problem 1a Let kj and ij be the values of k and i respectively after statement i := i + i is executed j times. Then we observe that i0 = 2, k0 = 1 and ij = 2j +1 , kj = i21 = 22j . j The loop ends when kj = 22j n, or j l

CAS 702 Data Structures and Algorithms
Midterm Exam - 30 points, 4 problems, 2 pages October 8, 2008 * justify your answers *
Name:
Student number:
Signature:
Problem 1
a. Find a theta notation, i.e. (.), for the number of times the statements i = i i is