1 / 7

Amortisierung

Amortisierung. Informatik II, SS 2008 Algorithmen und Datenstrukturen Vorlesung 12 Prof. Dr. Thomas Ottmann. Algorithmen & Datenstrukturen, Institut für Informatik Fakultät für Angewandte Wissenschaften Albert-Ludwigs-Universität Freiburg. Definition.

Download Presentation

Amortisierung

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Amortisierung Informatik II, SS 2008 Algorithmen und Datenstrukturen Vorlesung 12 Prof. Dr. Thomas Ottmann Algorithmen & Datenstrukturen, Institut für Informatik Fakultät für Angewandte Wissenschaften Albert-Ludwigs-Universität Freiburg

  2. Definition • Unter den amortisierten worst-case Kosten einer Folge o1, ..., on von Operationen, die auf einer gegebenen Struktur ausgeführt werden, versteht man die durchschnittlichen Kosten pro Operation für eine schlechtest mögliche Wahl der Folge o1, ..., on . • Genauer als simple, oft zu pessimistische worst-case-Analyse • Mögliche Vorgehensweisen bei der amortisierten worst-case-Analyse: • Gesamtkosten der Operationsfolge berechnen und Durchschnitt bilden (Aggregat Methode) • Bankkonto Paradigma: Bezahle für die „billigen“ Operationen (freiwillig) etwas mehr und bezahle die teueren von den Ersparnissen • Potentialmethode Informatik II: Algorithmen und Datenstrukturen, SS 2008 Prof. Dr. Thomas Ottmann

  3. Beispiel: Bitwechselkosten eines Dualzählers • Ein anfangs auf 00...0 initialisierter, k-stelliger Dualzähler wird schrittweise um jeweils 1 heraufgezählt. • Bitwechselkosten: 1 für jeden Wechsel 0  1 und 1  0. • Frage: Welche (durchschnittlichen) Bitwechselkosten pro Inkrementoperation entstehen, wenn m Inkrementoperationen ausgeführt werden? • Kosten • 0 0 0 0 0 • Worst-case-Analyse: Informatik II: Algorithmen und Datenstrukturen, SS 2008 Prof. Dr. Thomas Ottmann

  4. Aggregat Methode • Zählerstand #Bitwechsel Kosten • 0 0 0 0 0 Jedes 2-te mal wechselt 1 Bit • Bitwechselkosten für • m Operationen: Informatik II: Algorithmen und Datenstrukturen, SS 2008 Prof. Dr. Thomas Ottmann

  5. Bankkonto Paradigma • Bezahle 2 € für jede Inkrement-Operation (mit wirklichen Kosten 1 €). • Zählerstand bezahlt • 0 0 0 0 0 Informatik II: Algorithmen und Datenstrukturen, SS 2008 Prof. Dr. Thomas Ottmann

  6. Potentialmethode • Sei F: D  IR, D Menge der Dualzählerzustände • Sei Fi das „Potential“ des Dualzählers nach der i-ten Inkrement Operation. • ti = wirkliche Kosten der i-ten Operation • Definiere die amortisierten Kosten ai der i-ten Inkrement Operation durch: • ai = Informatik II: Algorithmen und Datenstrukturen, SS 2008 Prof. Dr. Thomas Ottmann

  7. Potentialänderung bei Inkrement • i-te Inkrement Operation erzeugt aus Zählerstand Di-1 den Zählerstand Di. Informatik II: Algorithmen und Datenstrukturen, SS 2008 Prof. Dr. Thomas Ottmann

More Related