COT 5405
Analysis of Algorithms
Spring 2005
OnCampus Comprehensive Exam
Name: __________________________________________
UFID: ____________  ____________
Email: _________________________________________
Instructions:
1. Write neatly and legibly
2. While grading, not only your final answer but also your
approach to the problem will be evaluated
3. You have to attempt ALL THREE problems. You have
choices under each problem.
5. Total time for the exam is 120 minutes
6. You are not allowed to use a calculator for this exam
I have read carefully, and have understood the above
instructions. On my honor, I have neither given nor received
unauthorized aid on this examination.
Signature: _____________________________________
Date: ____ (MM) / ____ (DD) / ___________ (YYYY)
Analysis of Algorithms Spring 2005
OnCampus Final Exam
Page 1 of 15
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Q1.
Please attempt only 2 out of the following 3 subparts
(7.5 points each = total 15 points)
a)
You are interested in analyzing some hardtoobtain data from two separate databases
having
n
and
m
numerical values – so there are
n
+
m
values in total – and you may
assume that no two values are the same. You’d like to determine the median of this set of
n
+
m
values, which we will define here to be the (
n
+
m
)/2
th
smallest value. However, the
only way you can access these values is through
queries
to the databases. In a single
query, you can specify a value
k
to one of the two databases, and the chosen database will
return the
k
th
smallest value that it contains. Give an efficient algorithm that finds the
median assuming that each query to any of the databases requires constant time. Also,
derive the asymptotic complexity of your algorithm.
This is the end of the preview.
Sign up
to
access the rest of the document.
 Fall '08
 UNGOR
 Algorithms, Analysis of algorithms, Computational complexity theory, oncampus final exam

Click to edit the document details