University of Maryland University College
CMSC 451 Design and Analysis of Computer Algorithms
Assignment: Homework 1
Instructor: Mark Munoz
Due Date:
Student:
1. Given the following function that evaluates a polynomial whose coefficients are stored in an
1.
HW 3
Recursion tree:
2.
Number of nodes:
The sort method is traversed n + 1 times for array length of n. The smallest method is traversed
for n, n-1, n-2, n-3,.1 times in the recursion tree. The smallest method would be n*(n+1) / 2.
Equation: 1 + (n +
1. f(n) = 3n^2 + 5
g(n)= 53n + 9
(g) = n
(f) = n^2
f (g) is True because for all values of n f(n) will be larger than n.
g (f) is True because for large value of n g(n) will be smaller than n^2.
2.
3.
log 3 n = log 2 n
n
10n + 7
n log 2 n
2
n + 5n + 10
3
HW 5
1.
Example of a weighted graph for which the minimum spanning tree is unique:
E
B
1
4
A
1
3
D
G
5
6
2
C
F
7
8
The minimum spanning tree for the graph above is:
E
B
1
4
A
1
3
D
G
5
6
2
C
F
7
8
Example of a weighted graph that has more than one minimum
1.
double evaluate(double[] coefficients, int n, double x)
double result = coefficients[0];
double power = 1;
for (int i = 1; i < n; i+)
power = power * x;
result = result + coefficients[i] * power;
return result;
/1
/1
/1
/ 1 + 3n
/1
/1
/1
The worst case
Consider the following directed graph for each of the problems:
A
F
B
H
D
E
G
C
I
J
K
1. Perform a breadth-first search on the graph assuming that the vertices and adjacency lists
are listed in alphabetical order. Show the breadth-first search tree that i
University of Maryland University College
CMSC 451 Design and Analysis of Computer Algorithms
Assignment: Homework 4
Instructor: Mark Munoz
Due Date:
Student:
Consider the following directed graph for each of the problems:
1. Perform a breadth-first searc
University of Maryland University College
CMSC 451 Design and Analysis of Computer Algorithms
Assignment: Project 2
Instructor: Mark Munoz
Due Date:
Student:
Introduction of the Quicksort algorithm
Quicksort uses divide-and-conquer, so it's a recursive al
University of Maryland University College
CMSC 451 Design and Analysis of Computer Algorithms
Assignment: Homework 6
Instructor: Mark Munoz
Due Date:
Student:
1. Compute the reflexive closure and then the transitive closure of the relation below. Show the
University of Maryland University College
CMSC 451 Design and Analysis of Computer Algorithms
Assignment: Homework 2
Instructor: Mark Munoz
Due Date:
Student:
1. Given the following two functions:
f(n) = 3n2 + 5
g(n) = 53n + 9
Use limits to prove or dispr
University of Maryland University College
CMSC 451 Design and Analysis of Computer Algorithms
Assignment: Project 1
Instructor: Mark Munoz
Due Date:
Student:
This document contains both the recursive and iterative java codes as well as the analysis for ea
University of Maryland University College
CMSC 451 Design and Analysis of Computer Algorithms
Assignment: Homework 3
Instructor: Mark Munoz
Due Date:
Student:
Consider the following functions for problems 1 and 2.
void selectionSort(int array[])
cfw_
sort
University of Maryland University College
CMSC 451 Design and Analysis of Computer Algorithms
Assignment: Homework 5
Instructor: Mark Munoz
Due Date:
Student:
1. Give an example of a weighted graph for which the minimum spanning tree is unique. Indicate w
1. Breadth-first search
A
B
H
D
E
F
G
C
I
J
K
2. Depth-first search
1
A
Tree
2
B
3
4
H
10
E
8
F
G
7
Cross
5
D
Back
9
C
11
6
12
I
J
K
14
13
3. DAG
1
A
Tree
2
B
3
5
D
4
G
Cross
10
E
8
F
7
9
H
C
11
6
12
I
J
K
Topological Order:
ABDGFHECIJK
Another Topologica