这样可以么?for each node v
perform a maximal flow between v and 0 to obtain the minimal cut (=mc);
set the key of v to mc and insert it into a Fibonacci heap h;
end
while(true)
v = h.extract_min(); (based on the key)
remove v and all edges incident on v;
if(node 1 is disconnected from node 0)
return v.key;
end
end
顺带询问一个问题
是CLRS page 216 10.4-5
Write an O(n)-time nonrecursive procedure that, given an n-node binary tree, prints out the key of each node. Use no more than constant extra space outside of the tree itself and do not modify the tree, even temporarily, during the procedure.
Write an O(n)-time nonrecursive procedure that, given an n-node binary tree, prints out the key of each node. Use no more than constant extra space outside of the tree itself and do not modify the tree, even temporarily, during the procedure.