



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
Main points of this past exam are: Prim's Algorithm, Algorithms, Advanced Data Structures, General Greedy, Minimum Spanning Tree, Implicitly Colors, Edge Weights, Consistent, Changkey, Million.
Typology: Exams
1 / 7
This page cannot be seen from the preview
Don't miss anything!
Increasing d makes insert and changekey run faster, while it makes deletemin slower. We can get the right approximate value by making the time for all the inserts and changekeys equal to the time for the deletemins. Setting (n+n 4/3^ ) logd n = nd log (^) d n gives us d=1+n 1/3. With this choice of d, the heap will have four levels.
What if the inserted item had a key of 500 thousand? Explain. Since half of the heap items are in the bottom level, we would expect those items above the bottom level to have key values smaller than 500 thousand. So typically, siftup would only go one or two iterations in this case.
Suppose that instead of insert, we did a deletemin. Approximately how many iterations would the siftdown procedure perform? Explain.
The siftdown operates on the item that was originally in the last position of the heap. So, it will typically have a larger key than the items in all but the last level. So, we would expect the siftdown to go through all 14 levels or nearly that many.
Suppose that we selected an item at random and did a changekey on that item with a new key value of 60,000. Estimate the number of levels the item will move. Explain.
Since most of the items are on the bottom few levels, it’s likely that the randomly selected item will also come from the bottom few levels. It’s new key value is about 1/16 from the top, which means its final position would most likely be in the fourth or fifth level up from the bottom. So, we can expect it to siftup by three or four levels.
sadt is a shortest augmenting path on which we can add 2 units of flow Identify a maximum capacity augmenting path in the residual graph. How much flow can be added to this path? scebdt is a max capacity path on which we can add 4 units of flow.
Find the path that would be selected by the capacity scaling algorithm if the current scale factor was 3. How much flow can be added to this path?
The capacity scaling algorithm would return the path scadt on which we can add 3 units of flow.
s
a
c
b
d
e
t
7
4
3
2
3
2
2
(^4 2 )
4
3
2
3
1
2
2
level (^) k ( u )≤ 50 since vertices on the augmenting path must have level values no larger than level(t)=50.
Suppose that during step k+1 , an edge ( u , v ) is added to the residual graph. Give an equation relating the value of level (^) k ( u ) to level (^) k ( v ). Explain your answer
level (^) k ( u )= level (^) k ( v )+1, because an edge is added to the residual graph only when the reverse of that edge is on the augmenting path, and edges on the augmenting path have increasing level values.
Give an equation relating the value of level 99 ( u ) to level 99 ( v ). Explain your answer.
level 99 ( u )= level 99 ( v )+1, because if the level values of either u or v had increased in steps 100 thru 160 then the edge (v,u) could not have been chosen for the augmenting path in step 161.
Let S be the set of edges ( x , y ) for which level 99 ( y )= level 99 ( x )+1. Is it possible for S to have exactly 85 edges? Why or why not?
This is not possible. Every augmenting path step from 100 to 200 must saturate an edge in S and each edge can be saturated at most once while the path lengths remain at 50. So, there must be at least 100 edges in S.