CSE 5311 Section 003 Fall 2004
Quiz 7 Solution
December 1, 2004
This is a closed-book, closed-notes, closed-computer, closed-neighbor quiz.
1. Consider the following set of points.
(a) (2 points) Draw the convex hull on the above set of points.
See above.
CSE 5311 Section 003 Fall 2004
Quiz 6 Solution
November 17, 2004
This is a closed-book, closed-notes, closed-computer, closed-neighbor quiz.
1. Consider the following PRAM CRCW algorithm Factorial(L,n) that stores the values n . . . 1
in a singly-linked l
CSE 5311 Section 003 Fall 2004
Quiz 5 Solution
November 3, 2004
This is a closed-book, closed-notes, closed-computer, closed-neighbor quiz.
1. (3 points) Show the minimum spanning tree of the following graph.
1
a
6
2
b
c
7
d
5
a
3
e
4
1
b
2
c
MST
f
d
5
e
CSE 5311 Section 003 Fall 2004
Quiz 4 Solution
October 20, 2004
This is a closed-book, closed-notes, closed-computer, closed-neighbor quiz.
1. Consider a data structure that inserts keys in constant time, except that after every 10th key
is inserted, the
CSE 5311 Section 003 Fall 2004
Quiz 3 Solution
October 6, 2004
This is a closed-book, closed-notes, closed-computer, closed-neighbor quiz.
1. (5 points) Show the nal B-tree that results from inserting the keys A, B, C, D, E, F, G, H
and I (in this order)
CSE 5311 Section 003 Fall 2004
Quiz 2 Solution
September 22, 2004
This is a closed-book, closed-notes, closed-computer, closed-neighbor quiz.
1. Consider the problem of sorting, in worst-case linear time, an array A of 10,000 9-digit social
security numbe
CSE 5311 Section 003 Fall 2004
Quiz 1 Solution
September 8, 2004
This is a closed-book, closed-notes, closed-computer, closed-neighbor quiz.
1. Below is pseudocode for the iterative algorithm SortedInsert, which inserts the key k into
an already sorted ar
33 1 5r ra x 3 f y a
qf 4q0BuBqV`4u e (SQqnvi@ e
fv1sq e wiqr4 e d q43 tQusQqV`@ e v! vs e v~4qrQqi
p p ! a p a e f 3 1 5r ra x 1 a Y y f ! y Y c33 1 pa a f f
a 1 !3
t440xyXv4pvQaT43 tHQusQqV`svP e Ti e &qiqivqihq@PQT d
! p 1 f p Y f 3 1 5r ra xr ! !
A
B
D
N
H
K
Q
T
F
A
C
D
B
Insert B
H
F
K
Q
T
N
Insert C
j ` 1 br
qi e 0&!
p u ! p ! 1 p u ! b f ! w b 3 y f b f b r f x 1
odq#q e Tod(u(4Yiqiv4@ e Ygv! vYYgqYhP@ e ~ e P&! a
F
A
D
N
H
K
Q
T
5 b p w y ! w b r ! 3 b p f !
ncfw_Yvvw v4hz@YYs04g~43 g@ e
k
X ! ! r ! v ! X ! r v v ! 1 i e r ! r e 1 X a 1 r ! r
4f q # YHssYW#2Q`4uTtYk`s(Sv
1 q Y ur q a q `4Htfa 4`(QuuPf q f401 q f&4dT
a 3 b e X e h
e 3 1 ! 1 h ! ! ! e r 1 w r e d r r ! X 5 b
43 k
e r ! e1 X a
Yuug`r `Tt
1 r
t! `Fa q `4H4 q n@fa 0!
u
u
5
t n
~ ( cfw_ (
h Sx(Qvubv(Y
h W1 h d a ` y ! 31
g TXxy f f u(x @ g x(Q~usf(Y06X2bi( qcSXqY
e h g W 3 d h W 1 h 3 1 1 d y 1 ! h W dd
hY cfw_Y(b g v&4XqqT g p43 i#v4#(xSxx4 g T6v4cfw_(x g ~(
q 1 d d 1 ! ` 3 h d ` 3 W 3 d ! ! e W 3 d y
! y d
CSE 143 Quiz 8 May 24, 2001
Name _
1. This question refers to the following binary tree.
a
i
b
c
d
f
e
g
j
h
k
(a) Which node(s) are the root(s) of the tree?
a
(b) Which node(s) are the leaf(s) of the tree?
d, e, g, h, k
(c) Which node(s) are ancestor(s)
CSE 143 Quiz 7 May 22, 2001
Name _
1. Give the lowest bound for the running time of the following code fragments, using O( )
notation. Your answers should be chosen from O(n), O(n2), O(n3), O(2n), O(n log n), O(1), or
O(log n).
(a) for (i = 0; i < n; i+)
CSE 143 Quiz 6, May 15, 2001
Name _
There are several ways to implement a stack of integers. Here is one representation, using an
array:
class IntStack cfw_
public:
private:
int capacity;
int * items;
int size;
;
/ number of elements in the dynamically al
CSE 143 Quiz 5, May Day, 2001
Name _
Here are two simple class definitions. To save space, the method bodies for the first class are
written in the class declaration, and public and private are not placed on separate lines.
class B cfw_
public: B(int x) c
CSE 143 Quiz 4, April 24, 2001
Sample Solution
Here is the definition of a simple class. The bodies of all methods have been replaced with a print
statement so we can trace the order in which they are called.
class Test cfw_
public:
/ constructor
Test() c
CSE 143 Quiz 3, April 12, 2001
Name _
Please read all the questions carefully and raise your hand for assistance if you have any
questions. Keep your answers brief (but you can use the back side of the page if needed).
1. In Wednesdays lecture, we discuss
CSE 143 Quiz 2, April 3, 2001
Name _
Please read all the questions carefully and raise your hand for assistance if you have any
questions. Keep your answers brief.
1.) Suppose we see the following line of code in a program:
ifstream thing(some.txt)
(a) Wh
CSE 143 Quiz 1, March 29, 2001
Name _
Please read all the questions carefully and raise your hand for assistance if you have any
questions.
1.) The following data structure stores information about 100 students. Print on the standard
output stream the nam
CSE 143 Sp01 Midterm 2
Sample Solution
page 1 of 7
Part I: Short Answer (6 questions, 18 points total)
Answer all of the following questions. READ EACH QUESTION CAREFULLY. Answer each
question in the space provided on these pages. Budget your time so you
CSE 143 Sp01 Midterm 1
page 1 of 5
Part I: Short Answer (4 questions, 18 points total)
Answer all of the following questions. READ EACH QUESTION CAREFULLY. Answer each
question in the space provided on these pages. Budget your time so you spend enough on
s
CSE 143 Sp01 Final Exam
Sample Solution
page 1 of 14
Part I: Short Answer (12 questions, 65 points total)
Answer all of the following questions. READ EACH QUESTION CAREFULLY. Answer each
question in the space provided on these pages. Budget your time so
CSE 142, Autumn 2011
Midterm Exam: Friday, November 4, 2011
Name:
_
Section:
_ TA: _
Student ID #:
_
You have 50 minutes to complete this exam.
You may receive a deduction if you keep working after the instructor calls for papers.
This exam is open-book.
CSE 142 Sample Final Exam #8
(based on Summer 2009's final; thanks to Victoria Kirst)
1. Array Mystery
Consider the following method:
public static void arrayMystery(int[] a) cfw_
for (int i = 1; i < a.length - 1; i+) cfw_
a[i] = a[i + 1] + a[i - 1];
In
CSE 142 Sample Final Exam #6
(based on Summer 2008's final; thanks to Hlne Martin)
1. Array Mystery
Consider the following method:
public static void arrayMystery(String[] a) cfw_
for (int i = 0; i < a.length; i+) cfw_
a[i] = a[i] + a[a.length - 1 - i];
CSE 142 Sample Final Exam #4
(based on Winter 2008's final)
1. Array Mystery
Consider the following method:
public static void arrayMystery(int[] a) cfw_
for (int i = a.length - 1; i >= 0; i-) cfw_
if (a[i] = a[a.length - i - 1]) cfw_
a[i]+;
a[a.length -
CSE 142 Sample Final Exam #3
(based on Autumn 2007's final)
1. Array Mystery
Consider the following method:
public static void arrayMystery(int[] a) cfw_
for (int i = a.length - 2; i > 0; i-) cfw_
if (a[i + 1] <= a[i - 1]) cfw_
a[i]+;
Indicate in the r