程序代写代做代考 graph C database algorithm Review oftheasymptoticnotation

Review oftheasymptoticnotation

bMd
Egan
no
Hii
is
EAnyCubicx x 0u2
Any quadraticfunction I Any brain
0cm OH

I
E Any linear
I
Any
cubic function
is
No
μ
re
fW
Ring
R SL
Any quadratic function
in
Cri
n

NO
I Any quadraticfunction is
0 uz 0cm
E
E Anycubic x is 062
Any
linear function is
tf
Czga
c gen
47

linear search EEE
worst
Case Best
041,04 041.04 ru
i
iE

Exponentiacl omponent polynomial
logarithmic
fastest growing
r
slowestgrowing
worstane performance Is
x

I
a
JIB
Cc
t
0

n
Takes 0
Mtn
O

B r
B n
IH A A
i

X h
i
o
Y Z
3 44
FACT
5 X
Ifagraph Gis bipartite then taunt
contain anoddcycle
lengthythecycle 2 4 ith odd
is

owM Ohm
overallcomplexity 0 men to m
0
Mtn

Bruteforcesolution every node
Run BESIDES from takesOCount
W
are
mutwallyreaokabk.no

c

dm
O 01M
m
Talas
0
Mtn

Discussion 2
1. Arrange the following functions in increasing order of growth rate with g(n) following f(n) in your list if and only if f(n) = O(g(n))
log nn, n2, nlog n, n log log n, 2log n, log2 n, n􏰏2
2. Suppose that f(n) and g(n) are two positive non-decreasing functions such that f(n) = O(g(n)). Is it true that 2f(n) = O(2g(n) )?
3. Find an upper bound (Big O) on the worst case run time of the following code segment.
void bigOh1(int[] L, int n)
while (n > 0)
find_max(L, 􏰁); //fi􏰁d􏰆 􏰄he ma􏰉 i􏰁 L[0􏰐􏰁-1] n = n/4;
Carefully examine to see if this is a tight upper bound (Big 􏰑)
4. Find a lower bound (Big 􏰒) on the best case run time of the following code segment.
string bigOh2(int n)
if(n == 0) return “a”;
string str = bigOh2(n-1);
return str + str;
Carefully examine to see if this is a tight lower bound (Big 􏰑)
5. What Mathematicians often keep track of a statistic called their Erd􏰓s Number, after the
great 20th century mathematician. Paul Erd􏰓s himself has a number of 􏰔ero. An􏰊one who wrote a mathematical paper with him has a number of one, anyone who wrote a paper with someone who wrote a paper with him has a number of two, and so forth and so on. Supposing that we have a database of all mathematical papers ever written along with their authors:
a. Explain how to represent this data as a graph.
b. E􏰉plain how we would compute the Erd􏰓s number for a particular researcher.
c. E􏰉plain how we would determine all researchers with Erd􏰓s number at most two.

6. In class, we discussed finding the shortest path between two vertices in a graph. Suppose instead we are interested in finding the longest simple path in a directed acyclic graph. In particular, I am interested in finding a path (if there is one) that visits all vertices.
Given a DAG, give a linear-time algorithm to determine if there is a simple path that visits all vertices.

2
high
tog
Z
notexponential
nyu
logarithmic
i
high
n
0 logy
exponential
0
assume
logz
g
n nbgtogn.nwgn.hr ri
toga

fca 2
2n 2h
to
gcn i
n

bog
Takes
tChk cufft
064 Ch
1
Cht
2Cn_
tight
tcYy bond
zone
0cal

Best care
performance
II
in
0
return A
aa
2 Aaaa
1
i i
n Bestcaseperf
064
2

a nodes represent edges
mathematicians
co
b BFS c
authorship
from
Endo’s

AoB c
AT
3 CADB
A
A
B
pg

local opt I
global opt d
inn

try 2
SmallestrequestfirstX s
t
Earliest start time X
try
I_
E
_xl

try
3
smallest
of overlapsfirst
try
will
4
This
lead us to the opt
Ear least Finish time