{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Hausuebung_08_averageCase - Altinger Harald 0630936 Idee...

Info iconThis preview shows pages 1–5. Sign up to view the full content.

View Full Document Right Arrow Icon
Idee: gehe alle Orte durch (1...n); setze all Nachbarn auf die Andere Marke (1...k) gehe zum naechsten Ort setze nie einen Nachbarn mit kleinerem Index auf einen andere Marke breche ab wenn ein Ort bereits einen Nachbarn der selben Marke hat C Code: village(1) = A; for (count_village=1, count_village<n; count_village++) { if(village(count_village) == A) for(count_neigbour; count_neigbour < k; count_neigbour++) { if(neigbour(count_Village) != A) neigbour(count_Village) = B; else return -1; } else for(count_neigbour; count_neigbour < k; count_neigbour++) { if(neigbour(count_Village) != B) neigbour(count_Village) = A; else return -1;
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Background image of page 2
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Background image of page 4
Background image of page 5
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}