{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

07_Vorlesung_22_Nov_2007

# 07_Vorlesung_22_Nov_2007 - Datenstrukturen Algorithmen VO...

This preview shows pages 1–7. Sign up to view the full content.

22.11.2007 [email protected] Datenstrukturen & Algorithmen VO 708.031 7. Vorlesung, am 22.Nov. 2007

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

View Full Document
22.11.2007 [email protected] Achtung: Vorlesung nächste Woche ( 29.Nov ) fällt aus !
22.11.2007 [email protected] Wiederholung – Partition Zerlegen von Feldern Speichere das lineare Feld A[n] so um, dass folgendes gilt: A[l] A[r] für alle l=1,2,…k und r = k+1,k+2,…n. Definition Zerlegen: lineares Feld A[1. .n] klein groß k lr

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

View Full Document
22.11.2007 [email protected] Zerlegen (Partition) Das Bezugselement ist das sog. Pivotelement PARTITION (A, l , r) 1: p = A[l] 2: j=l-1 , k=r+1 3: LOOP REPEAT j=j+1 UNTIL A[j] p 4: REPEAT k=k-1 UNTIL A[k] p 5: IF j < k THEN 6: vertausche (A[j], A[k]) 7: ELSE 8: RETURN k Laufzeit: Θ (n) Pivotelement
22.11.2007 [email protected] Quicksort QUICKSORT (A , l , r) 1: IF l < r THEN 2: k = PARTITION (A,l,r) 3: QUICKSORT (A,l,k) 4: QUICKSORT (A,k+1,r) [LINK] T(n) = O(n) + T(k) + T(n-k) klein groß k T(1) = O(1)

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

View Full Document
22.11.2007 [email protected] Quicksort-Laufzeit Beobachtung: • Pivotelement ist wichtig • Tiefe des Rekursionsbaums hängt davon ab (balancend-unbalanced) • Best case: balanced (a)
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 11

07_Vorlesung_22_Nov_2007 - Datenstrukturen Algorithmen VO...

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

View Full Document
Ask a homework question - tutors are online