MCS 401, Spring 2011, Final Exam, Topics
Outline
April 29, 2011
asymptotic notation, worst-case and average case of algorithms
recurrences, solution methods, master theorem
probabilistic analysis, randomized algorithms, hiring problem
sorting algorith

MCS 401 - Computer Algorithms I
Spring 2011
Midterm 2 Solutions
Problem 1
methods.
Table 1 presents the indices where the values are hashed for each one of the three requested
position (index)
linear probing values
quadratic probing values
double hashing

MCS 401 - Computer Algorithms I
Spring 2011
Midterm 1 Solutions
Problem 1 This problem was exercise 5.2-2 (Homework 2). The probability that we hire exactly two
times, is the probability that the best possible candidate does not arrive rst in the sequence

MCS 401 - Computer Algorithms I
Spring 2011
Homework 7 Solutions
Exercise 26.1-2 We use the construction described on page 712 and Figure 26.3.
The capacity constraint remains valid, while the ow conservation property is true for all the vertices
that are

MCS 401 - Computer Algorithms I
Spring 2011
Homework 6 Solutions
Exercise 22.4-2
We perform topological sorting on the given graph. This takes (V + E) time
with depth rst search. After computing the topological sorting, one can proceed backwards from t to

MCS 401 - Computer Algorithms I
Spring 2011
Homework 5 Solutions
Extra Exercise
Table 1 presents the tables with the W and the e values for the problem.
0.0
0.3
0.0
0.4
0.1
0.0
0.5
0.2
0.1
0.0
0.7
0.4
0.3
0.2
0.0
1.0
0.7
0.6
0.5
0.3
0.0
1
0.3
2
0.5
0.1
3

MCS 401 - Computer Algorithms I
Spring 2011
Homework 4 Solutions
Exercise 11.2-3
We have
Successful Searches Assuming equal probability for all the elements in the list, the expected time for
a successful search is nj /2, or udner the assumption of unifor

MCS 401 - Computer Algorithms I
Spring 2011
Homework 3 Solutions
Exercise 7.2-4 Since the input is almost sorted we do not expect any given entry to change more
than some appropriate constant c > 0 number of positions in the nal sorted array. Hence, the r

MCS 401 - Computer Algorithms I
Spring 2011
Homework 2 Solutions
Exercise 5.2-1
a. The probability to hire exactly one time, is the probability that the best possible candidate arrives
rst. Hence, assuming uniform distribution on the arrival of the candid