CSE310 HW01 Grading Keys
1. (10 pts) Let
f
(
n
) =
n
2
and
g
(
n
) = 100
×
n
×
log
2
n
. Find the smallest integer
N
≥
0 such
that
f
(
N
)
≤
g
(
N
) but
f
(
N
+ 1)
> g
(
N
+ 1). Show the values of
N
,
f
(
N
),
g
(
N
),
f
(
N
+ 1)
and
g
(
N
+ 1).
Solutions:
How to obtain the correct
N
? You can write a program to iteratively check for
N
= 1
,
2
, . . .
.
N=996, f(N)=992016, g(N)=992016.19, f(N+1)=994009, g(N+1)=993156.
Grading Keys:
6 pts for the value of
N
, 1 pt each for
f
(
N
)
, g
(
N
)
, f
(
N
+ 1)
, g
(
N
+ 1).
2. (10 pts) For each function
f
(
n
) (the row index in the following table) and time
t
(the column
index in the following table),
determine the largest size
n
of a problem that can be solved in
time
t
, assuming that the algorithm takes
f
(
n
)
microseconds
to solve an instance of a problem
of size
n
. Fill the value
n
in the corresponding entry.
1 second
1 minute
1 hour
1 day
1 year
√
n
10
12
3
.
6
×
10
15
1
.
296
×
10
19
7
.
46496
×
10
21
9
.
95
×
10
26
n
10
6
6
×
10
7
3
.
6
×
10
9
8
.
64
×
10
10
3
.
154
×
10
13
n
2
10
3
7745
6
×
10
4
293938
5616048
2
n
19
25
31
36
44
How to get those numbers? For the first function, you can easily solve the equation to get
the answer. For the next two functions, you can solve the equation to obtain a real valued
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
 Davulcu,H
 Algorithms, Data Structures, pts, 1 pt, 2 pts, 1 second, 0.5 pt

Click to edit the document details