12.07.2015 Views

Scientific Writing for Computer Science Students - FTP Directory ...

Scientific Writing for Computer Science Students - FTP Directory ...

Scientific Writing for Computer Science Students - FTP Directory ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

6.10. WRITING ALGORITHMS IN LATEX 109Alg. 2 SelfReferringSets(G, min f ). An algorithm <strong>for</strong> searching all stronglyself-referring sets in graph G = (V, E).Input: G = (V, E), min fOutput: Y ⊆ V1 begin2 compute all connected components in G = (V, E)3 <strong>for</strong> each connected component V ′ in G = (V, E) do4 <strong>for</strong> all v ∈ V ′ dfs({v}, degree(v), min f , v)5 endAlg. 3 dfs(X, d, min f , last). A depth-first search of the self-referent sets insubgraph G ′ = (V ′ , E ′ ).Input: X ⊆ V, d, min f , lastOutput: Y ⊆ V ′1 begin2 if f ref (X) ≥ min f then3 output X4 else if (f ref (X) < 1 − d(1−min f )(|X|−1)min f)5 then return // search failed6 <strong>for</strong> all vertices u ∈ V ′ (u > last and ∃v ∈ X (v, u) ∈ E) do7 dfs(X ∪ {u}, d, min f , u)8 end6.10.2 Exercises1. Write Algorithm 4! Test how to refer to it in the text (like here).2. Test how to write the following kind of method using an itemize list!Step 1 x = x + 1Step 2 y = x 2 + 1Step 3 If y ≤ n return to Step 1.3. Write an algorithm or a method to your paper!

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!