Java Vector - Data Structures - Exams, Exams for Data Structures. Bhupendra Narayan Mandal University

Data Structures

Description: Main points of this exam paper are: Java Vector, Worst Cases, Representation Consists, Current Length, Asymptotic Bounds, Right Place, Bound Means, Java Code, Functions Marked, Additional Declarations
Showing pages  1  -  2  of  13
Department of Electrical Engineering
and Computer Sciences
Computer Science Division
CS61B P. N. Hilfinger
Fall 2000
Final Examination
Your exam should contain 7problems on 13 pages. Officially, 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 first try to answer those parts about which
you feel most confident.
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
5. /5
6. /6
7. /7
TOT /50
Final Login: Initials: 2
1. [12 points] Answer each of the following briefly. 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.
The preview of this document ends here! Please or to read the full document or to download it.
Document information
Embed this document:
Docsity is not optimized for the browser you're using. In order to have a better experience please switch to Google Chrome, Firefox, Internet Explorer 9+ or Safari! Download Google Chrome