Präsentation herunterladen
Die Präsentation wird geladen. Bitte warten
Veröffentlicht von:Odelia Schlosser Geändert vor über 10 Jahren
1
Algorithm Engineering Schnelles Sortieren Stefan Edelkamp
2
Überblick Kriterien für Sortierverfahren State-of-the-Art Clever-Quicksort Heapsort Weak-Heapsort Quick-Heapsort Radix-Exchange-Sort Sortieren durch Fachverteilung
3
Kriterien für Sortierverfahren
4
State-of-the-Art
5
State-of-the-Art (2)
6
State-of-the-Art (3)
7
Clever-Quicksort (Median-of-3)
8
Σ
9
Implementierung Siehe Sedgewick: The analysis of quicksort programs, Acta Informatica, Journal of Algorithms, 15(1):76-100, 1993
10
Heapsort
11
Definition
12
Veranschaulichung
13
Entfernen des Maximums
14
Versickern
15
Pseudo-Code
16
Erstellung eines Heaps
17
Äußere Schleife
18
Analyse Iteriertes Versickern Σ
19
Analyse
20
Beobachtung
21
Bottom-Up- Heapsort
22
Pseudo-Code (1)
23
Pseudo-Code (2)
24
Worst-Case
25
Average Case
26
Weak-Heap-Sort
27
Verschmelzen
28
Generieren eines Weak-Heaps
29
Sortierung
30
Arrayeinbettung
31
3 Fälle
32
Pseudo Code
33
Analyse Σ
34
Engineering
35
Quick-Heapsort
36
Σ Σ
37
Pseudo-Code
38
Pseudo-Code (2)
39
Pseudo- Code (3)
40
Radix- Sort
41
Radix-Exchange-Sort
42
Beispiel
43
Unterscheidene Präfixe
44
Analyse
45
Sortieren durch Fachverteilen
46
Analyse
47
Illustration
48
Pseudo-Code (1)
49
Pseudo- Code (2)
50
Adaptives Sortieren Inversionen Inv(X) = {(i,j) | 1 <= i < j <= n und xi > xj} Ziel AE: 1*n log (Inv(X)/n)+O(n) Wenn Inv(X) = O(n²) n log n + O(n) Inversions-optimal := Laufzeit O(n log (Inv(X)/n)+n) Informationstheoretische Grenze: Ω(n log (Inv(X)/n)+n)
51
Kartesischer Baum Der kartesische Baum TF von F[1..n] ist ein geordneter gewurzelter Baum mit n Knoten. Der kartesische Baum des leeren Feldes ist der leere Baum. Sei k = min (1,n). Die Wurzel von TF ist markiert mit k, die Kinder sind die kartesischen Bäume von F[1..k 1] und F[k+1..n] (wobei F[i..j] das leere Feld ist, falls j < i).
52
Konstruktion (a la wikipedia) Process the sequence values in left-to-right order, maintaining the Cartesian tree of the nodes processed so far, in a structure that allows both upwards and downwards traversal of the tree. To process each new value x, start at the node representing the value prior to x in the sequence and follow the path from this node to the root of the tree until finding a value y smaller than x. This node y is the parent of x, and the previous right child of y becomes the new left child of x. The total time for this procedure is linear, because the time spent searching for the parent y of each new node x can be charged against the number of nodes that are removed from the rightmost path in the tree
53
Levcopoulos–Petersson Algorithmus Konstruiere Karteschen Baums für die Eingabe Initialisiere PQ mit der Wurzel des kartesischen Baumes Solange PQ nicht leer: 1.Finde und lösche den min. Wert x in PQ (DeleteMin) 2.Gebe x aus 3.Füge die Kinder von x im kartesischen Baum zu PQ hinzu (Insert)
54
Zeit
55
Vergleiche
Ähnliche Präsentationen
© 2024 SlidePlayer.org Inc.
All rights reserved.