UNIVERSITY OF CALIFORNIA

Department of Electrical Engineering

and Computer Sciences

Computer Science Division

CS61B P. N. Hilﬁnger

Fall 2000

Final Examination

Your exam should contain 7problems on 13 pages. Oﬃcially, it is worth 50 points.

This is an open-book test. You have three hours in which to complete it. You may consult

any books, notes, calculators, or other inanimate objects (other than computers) available to you.

You may use any program text supplied in lectures, problem sets, or solutions. Please write your

answers in the spaces provided in the test. Make sure to put your name, login, and lab section in

the space provided below. Put your login and initials clearly on each page of this test and on any

additional sheets of paper you use for your answers.

Read all the questions carefully to begin with, and ﬁrst try to answer those parts about which

you feel most conﬁdent.

Your name: Login:

Login of person to your left: Login of person to your right:

Discussion section number or time: TA:

1. /12

2. /10

3. /10

4.

5. /5

6. /6

7. /7

TOT /50

1

Final Login: Initials: 2

1. [12 points] Answer each of the following brieﬂy. Where a question asks for a yes/no answer,

give a brief reason for the answer (or counter-example, if appropriate).

a. If f(x)∈Θ(x3) and g(x)∈O(x2), and if there is some x0such that f(x0)> g(x0), then is

f(x)> g(x) for all x > x0? Assume fand gare everywhere positive.

b. If g(x) = x2cos x, is g(x)∈O(x2)? Is g(x)∈Ω(x)?

c. A sorted list of values is maintained as a Java Vector whose initial capacity is N0. That

is, the representation consists of an array (initially of length N0) and a current size (always

less than or equal to the current length of the array), and the array is expanded by factors

of two as needed. What are the tightest asymptotic bounds you can give for the best and

worst-case times for adding N=K·N0values to this list (inserted in the right place to keep

the list ordered), assuming the list is initially empty? (The “tightest” bound means “a Θ(·)

bound if possible, and otherwise the smallest O(·) bound and largest Ω(·) bound possible.”)

We want bounds for the worst-case time and bounds for the best-case time. Include brief

descriptions of the best and worst cases.

##### Document information

Uploaded by:
shashidhar_p43

Views: 1152

Downloads :
0

Address:
Engineering

University:
Bhupendra Narayan Mandal University

Subject:
Data Structures

Upload date:
02/04/2013