Hausuebung_08_averageCase

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

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Altinger Harald 0630936 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; } } return 0; Psydo Code: village(1) = A; PROVEVILLAGE(village,neigbor) for count_village = 1 to n step 1 do if village(count_village) == A then SETTYPE(B,neigbor(count_village)); if village(count_village) == B then SETTYPE(A,neigbor(count_village)); SETTYPE(newType,neigbor) for count_neigbor = 1 to k step 1 do if neigbor(count_neigbor) != newType neigbor(count_neigbor) = newType; else K_LITTLE_ELEMENT(x,A) for count = 1 to k do A(count) = getNextElement(); BAUE_HALDE(A); for count = k+1 to n do if x = getNextElement() < A(1) vertausche(A(1),x); Verhalde(A); ...
View Full Document

This note was uploaded on 11/19/2009 for the course HKJLHKJL 565 taught by Professor Fhfh during the Spring '09 term at University of Graz.

Page1 / 5

Hausuebung_08_averageCase - Altinger Harald 0630936 Idee:...

This preview shows document pages 1 - 5. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online