CSE 2320
Name
________________________________
Test 1
Fall 2003
Student ID #
___________________________
Multiple Choice.
Write your answer to the LEFT of each problem.
4 points each
1.
P
ARTITION
is useful in solving all of the following problems, except
A.
Finding the k smallest elements
B.
Q
UICKSORT
C.
Selection
D.
Splitting an array for M
ERGESORT
2.
Which of the following sorts is not stable?
A.
I
NSERTION
S
ORT
B.
LSD R
ADIX
S
ORT
C.
M
ERGESORT
D.
Q
UICKSORT
3.
Which of the following sorts is not based on key comparisons?
A.
I
NSERTION
S
ORT
B.
LSD R
ADIX
S
ORT
C.
M
ERGESORT
D.
Q
UICKSORT
4.
Suppose the input to H
EAPSORT
is always a table of identical integers.
The worstcase time will be
A.
Θ
(1)
B.
Θ
(n)
C.
Θ
(n lg n)
D.
Θ
(n
2
)
5.
Suppose the input to P
ARTITION
is always a set of identical integers.
The worstcase time will be
A.
Θ
(1)
B.
Θ
(n)
C.
Θ
(n lg n)
D.
Θ
(n
2
)
6.
The time to multiply two n x n matrices is:
A.
Θ
(n)
B.
Θ
(n lg n)
C.
Θ
(n
2
)
D.
Θ
(n
3
)
7.
f(n) = n lg n is in all of the following sets, except
A.
Ω
(lg n)
B.
Θ
(log(n!))
C.
O(1/n)
D.
O(n
2
)
8.
Which of the following best approximates H
m
– H
n
?
(m > n)
A.
H
mn
B.
1/(m – n)
C.
ln(m / n)
D.
ln(m  n)
9.
Which sort may be viewed as being an improvement on insertion sort?
A.
C
OUNTING
S
ORT
B.
H
EAPSORT
C.
Q
UICKSORT
D.
shellsort
10. Counting sort is often used as a part of which sorting algorithm?
A.
I
NSERTION
S
ORT
B.
LSD R
ADIX
S
ORT
C.
M
ERGESORT
D.
Q
UICKSORT
Long Answer
1.
Prove that if
f
(
n
) Î O
g
(
n
)
(
) then
1
f
(
n
)
Î W
1
g
(
n
)
ae
è
ç
ö
ø
÷.
10 points
2.
Use the substitution method to show that T(n) = 2T(n/4) + n is in
Θ
(n).
15 points
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document3.
Use the recursiontree method to show that T(n) = 2T(n/4) + n is in
Θ
(n).
15 points
4.
Demonstrate P
ARTITION
on the following array.
10 points
9
3
6
2
7
4
1
8
0
5
5.
Show the maxheap after performing H
EAP
E
XTRACT
M
AX
two times.
10 points
1
2
3
4
5
6
7
8
9
1
2
3
4
5
6
7
8
9
CSE 2320
Name
________________________________
Test 2
Fall 2003
Student ID #
___________________________
Multiple Choice.
Write the letter of your answer to the LEFT of each problem.
4 points each
Problems 1 and 2 refer to the following hash table whose keys are stored by linear probing using
h(key) = key % 13.
0
1
2
3
4
5
6
7
8
9
10
11
12
122
110
20
86
87
62
94
1.
143 would be inserted into which slot of the given table?
A.
0
B.
1
C.
2
D.
11
2.
136 would be inserted into which slot of the given table?
A.
0
B.
4
C.
6
D.
11
Problems 3 and 4 refer to the following hash table whose keys are stored by double hashing using
h
1
(key) = key % 13 and h
2
(key) = 1 + (key % 12).
0
1
This is the end of the preview.
Sign up
to
access the rest of the document.
 Spring '12
 BOBWEEMS
 Graph Theory, Sort, Flow network, Maximum flow problem, Graph algorithms

Click to edit the document details