程序代写代做代考 graph C algorithm go V 0

V 0
Amortized costanalysis
Binary Binomialheap
heap

Binayheap Fi
eiiniEI.in Decrease key U
Amortizes Binominlheap FibHeap
04h
u
Merge On 4 Construct O n Ocn
oifi
I
0C Oci Ocu
oiii
ii

Jesse
V
S

Sa
8yo 4
14 13 9 4
S S4
Se s Y z t
fsy
s
S3
552 S y z t X
Dijkstra’s
Alg s
Esy g

an
dn2 canbe reducedto0cm

Ii
total
Sparse Dense
k84 Oculgu 0cm in
Oculgn Ofw w On’lgn On’Gn O n
OCarlgu Oculgu
n
Och

znlg.no
n
0 t
n
lgn

I

Krusl
primp

Revesse Deheli

b
X
c
d
Eep
Kruskal’s Prim’s
Reverse Delete
x f
X

Kruskadj
v
s

mEnh t zin

Prim’s
le
coffee

a

0cal
colony
l
a 0

Kruskal’s overallperf 0 n 0cmGm
trim’s
0cmbn Kruskal
1
0cm lg ne
to
Oland OCmtgm
c
he

hwuse.DE gm
Tocwl e
f Sort
decreasingorder ocf ost
in Hui order Ykifremovingtheedgedrscoqg.geof
loop
μ
over edges
mdlotmfig.IT
oui
ocmg
dges
i

Discussion 4
1. Hardy decides to start running to work in San Francisco city to get in shape. He prefers a route that goes entirely uphill and then entirely downhill so that he could work up a sweat uphill and get a nice, cool breeze at the end of his run as he runs faster downhill. He starts running from his home and ends at his workplace. To guide his run, he prints out a detailed map of the roads between home and work with k intersections and m road segments (any existing road between two intersections). The length of each road segment and the elevations at every intersection are given. Assuming that every road segment is either fully uphill or fully downhill, give an efficient algorithm to find the shortest path (route) that meets Hardy’s specifications. If no such path meets Hardy’s specifications, your algorithm should determine this. Justify your answer.
2. You are given a graph representing the several career paths available in industry. Each node represents a position and there is an edge from node v to node u if and only if v is a prerequisite for u. Top positions are the ones which are not prerequisites for any positions. The cost of an edge (v, u) is the effort required to go from one position v to position u. Ivan wants to start a career and achieve a top position with minimum effort. Using the given graph can you provide a􏰁 alg􏰂􏰃i􏰄hm 􏰅i􏰄h 􏰄he 􏰆ame 􏰃􏰇􏰁 􏰄ime c􏰂m􏰈le􏰉i􏰄􏰊 a􏰆 Dijk􏰆􏰄􏰃a􏰋􏰆? Y􏰂􏰇 ma􏰊 a􏰆􏰆􏰇me 􏰄he g􏰃a􏰈h i􏰆 a DAG.
3. You have a stack data type, and you need to implement a FIFO queue. The stack has the usual POP and PUSH operations, and the cost of each operation is 1. The FIFO has two operations: ENQUEUE and DEQUEUE. We can implement a FIFO queue using two stacks. What is the amortized cost of ENQUEUE and DEQUEUE operations.
4. Given a sequence of numbers: 3, 5, 2, 8, 1, 5, 2, 7
a. Draw a binomial heap by inserting the above numbers reading them from left to right
b. Show a heap that would be the result after the call to deleteMin() on this heap
5. (a): Suppose we are given an instance of the Minimum Spanning Tree problem on a graph G. Assume that all edges costs are distinct. Let T be a minimum spanning tree for this instance. Now suppose that we replace each edge cost ce by its square, ce2 thereby creating a new instance of the problem with the same graph but different costs. Prove or disprove: T is still a MST for this new instance.
(b): Consider an undirected graph G = (V, E) with distinct nonnegative edge weights we􏰌0. Suppose that you have computed a minimum spanning tree of G. Now suppose each edge weight is increased by 1: the new weights are c􏰋e = ce + 1. Does the minimum spanning tree change? Give an example where it changes or prove it cannot change.

eat 14
W

i