Answers to exam 1 Section 1 of CSE 331 Spring 2008
The average was 71 with N=47;
high score was 96 and low in the 40's.
An average of 75 would have been better. While there were 15 strong
performances, many students can easily find another 5 points they
could have scored.
The histogram of scores is as follows:
< 60
6069
7079
8089
90100
8
13
11
12
3
ANSWERS:
None of these should have been difficult, since all were encountered in
class or on homework. Avg was probably 13; should have been at least 16.
1) O(N log N)
avg quicksort
2) O(N^2)
avg case insertion sort
3) O(N)
assuming the find is included
O(1) otherwise; either OK
4) O(N log N)
to build an AVL tree (tree sort)
5) O(N log N)
to do N/2 ops on a splay tree
6) O(N)
do post order processing of AVL tree to destruct it
7) O(N)
to merge O(log N) unsorted items with an array of N sorted
(HW problem)
8) O(N^2)
obvious nested for loops
9) O(2^N)
total nodes in perfect tree is 2^h+1
10) O(N^3)
first series is sum of N squares, which is known to be O(N^3)
11)
f(n) is Big Omega of g(n) iff there exist positive constants c and n0,
such that
f(n) >= c g(n)
for all n>=n0. (g(n) is an asymtotic
lower bound for f(n).)
Suppose n0 = 2. Then, for n>=n0,
n^3 > n^2.
So, 2 n^3  n^2 + 3 >= n^3 + 3 > n^3 > n^2.
Therefore, f(n) >= c g(n) for c = 1 and all n >=2 = n0.
The class did fairly well on this.
12)
Do in class.
Overall, the class needs improvement on induction.
13)
Here are three different approaches that students provided. The class overall
did well on this problem, but a few missed solving it. Despite new power from
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
This is the end of the preview.
Sign up
to
access the rest of the document.
 Spring '08
 M.McCullen
 Algorithms, Data Structures, Insertion Sort, Big O notation

Click to edit the document details