CSCI 4041: Algorithms and Data Structures
(Fall’09)
Homework 2, Due 10/08/09
Answer all of the following questions, and always explain your answer. Good Luck!
1. (40 points) This problem considers building a maxheap given an array of numbers. Recall that
CSCI 4041: Algorithms and Data Structures (Fall09) Homework 4, Due 11/24/09
Answer all of the following questions, and always explain your answer. Good Luck! 1. (50 points) Consider the activity selection problem with a set S = cfw_a1 , . . . , an of n p
CSCI 4041 HW#3 Solution Key (Fall 2009)
1. [30pt] a. [15pt] Successive calls to TreeSuccessor constitute a partial traversal of the tree, starting at node x and continuing for next k nodes. The successive calls will involve O(k+h) nodes, which implies a
CSCI 4041: Algorithms and Data Structures (Fall09) Homework 3, Due 11/10/09
Answer all of the following questions, and always explain your answer. Good Luck! 1. (30 points) This questions considers operations and properties of Binary Search Trees (BSTs):
CSCI 4041 HW#2 Solution Key (Fall 2009)
1. [40pt] a. [20pt] BUILDMAXHEAP and MYBUILDMAXHEAP procedures do not always create the same heap when running on the same input array. Here is the simple counterexample. Input array A = cfw_1, 2, 3 BUILDMAXH
h
t
/
/
*
m
h
t
i
r
o
g
l
a
e
v
i
t
a
r
e
t
i
s
i
s
i
h
T
*
{
)
n
e
e
z
s
a
y
r
a
r
/
{
o
d
;
/
n
=
n
i
e
d
;
t
1
t
a
,
a
=
t
r
s
t
r
s
,
v
,
A
(
H
C
R
A
E
S
_
Y
R
A
N
I
B
d
/
}
;
m
)
n
e
,
1
,
d
;

)
m
t
1
,
d
a
+
d
v
,
A
(
H
C
R
A
E
S
_
Y
R
A
s
,
v
,
A
CSCI 4041: Algorithms and Data Structures (Fall09) Homework 1, Due 09/24/09
Answer all of the following questions, and always explain your answer. Good Luck! 1. (50 points) Consider the following sorted search problem: Input: A sequence of n distinct sort