





Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!






% &''(') ' ' '(&%&
&%" % + %" % + .&& (/* %( 0+ 11( 20 % %*% +
% ( ( 0 % / 4 (&%"(* ((+ "( -&% 5 6(% (% (% 5 ( (% 1 (% &/ 7 8 (&% / ( 9 0 . (&%* 1 (&%+ :;((< %%%(% . (/ 0
" &0& 8 (&% C (&& % *C "&+% %
3 2 2 ( ( (*+ 2 %D *+& %(%"E C0&
6& 1 ( 0 ?(% %(%% 5 / (C" &" & " , (/& 6 5 & % -&% 5 ( & 0 %& ; 4 & %( / (&&% (&% *&%& % + (J 5 %&5" %%(&%
θ+ 2% 0 & %J %J & θ + 20& / J% θ* +
% / " 0 % / %% 6% 1" 5 11 & 5 1& %/ ( % 0 ,% ( %& 2 // 9 %/ %>?/ 5 / 5
; %&%% 5 1 % 6(% 5 1& *H9 % % 5 1 (/+
and so on…
O+ θ+ ,%1 5 4 / ,% 0 / 5 1&+ ,% % ,%O&+( % θ* + 1 % (%(&% ,%" & 0 /θ* K+ 5% %(% ,% : < (&% % =&(&% 20& / & & 0 /θ* +
Underwear Socks
Pants Shoes
Belt
Shirt
Watch
Tie
Jacket
Underwear Socks
Pants Shoes
Belt
Shirt
Watch
Tie
Jacket
Socks Underwear Pants Shoes Watch Shirt Belt Tie Jacket
Topological-Sort() { Run DFS_recurs() When a vertex is finished, output it Vertices are output in reverse topological order (or add to stack/list) }
top_sort ( adj , ts ) { n = adj****. last // k is the index in ts where the next vertex is to be // stored in topological sort. k is assumed global. k = n for i = 1 to n visit [ i ] = false for i = 1 to n if (! visit [ v ]) top_sort_recurs ( adj , i , ts ) } }