1 Helmut Schauer Educational Engineering Lab Department for Informatics University of Zurich Algorithmen und Datenstrukturen FS 2008 Hashtabellen.

Slides:



Advertisements
Similar presentations
Queues Printer queues Several jobs submitted to printer Jobs form a queue Jobs processed in same order as they were received.
Advertisements

Jeopardy Professions Modal Verbs Sentence Structure Modal Forms Female Professions Q $100 Q $200 Q $300 Q $400 Q $500 Q $100 Q $200 Q $300 Q $400 Q $500.
Informatik mit Java Grundkurs
Practising forming the future tense
Subjective Use of Modal Verbs. Basic Forms of Wollen She wants to read the novel Sie will den Roman lesen She wanted to read the novel Sie wollte den.
WAS LERNEN WIR UND WARUM? What are we learning and why?
1 Helmut Schauer Educational Engineering Lab Department for Information Technology University of Zurich Syntaxanalyse.
1 Helmut Schauer Educational Engineering Lab Department for Informatics University of Zurich Algorithmen und Datenstrukturen SS 2007 Helmut Schauer.
Modal Auxiliaries Present tense and past tense. Present Tense Modal Auxiliaries Sentence Structure Basic sentence structure: Ich lese ein Buch. Subject.
Stacks, Queues, and Linked Lists
Lab 8 Ordered list. OVERVIEW In an ordered list the elements are maintained in ascending (or descending) order based on the data contained in the list.
Sequence of characters Generalized form Expresses Pattern of strings in a Generalized notation.
For(int i = 1; i
Sets and Maps Part of the Collections Framework. 2 The Set interface A Set is unordered and has no duplicates Operations are exactly those for Collection.
Inheritance (2).
Dictionaries Chapter Chapter Contents Specifications for the ADT Dictionary Entries and methods Using the ADT Dictionary English Dictionary Telephone.
Stacks. What is a stack? Last-in first-out data structure (LIFO) New objects are placed on top Removal restricted to top object Examples?
Stacks.
AE 495 Project Progress Report XX Presentation, Put Date Here Put Your Presentation Title Here Names of the students in your group Department of Aerospace.
1 Helmut Schauer Educational Engineering Lab Department for Informatics University of Zurich Algorithmen und Datenstrukturen FS 2008 Bäume.
Collections A First Glimpse. Collections A collection is a structured group of objects –An array is a kind of collection –A Vector is a kind of collection.
Priority Queues. Priority queue A stack is first in, last out A queue is first in, first out A priority queue is least-first-out –The “smallest” element.
1 Foundations of Software Design Fall 2002 Marti Hearst Lecture 13: Queues and Vectors.
1 Topic 9 Maps "He's off the map!" -Stan (Mark Ruffalo) Eternal Sunshine of the Spotless Mind.
1 Helmut Schauer Educational Engineering Lab Department for Informatics University of Zurich Listen, Stacks und Queues headtail p x.
Dictionaries Chapter Chapter Contents Specifications for the ADT Dictionary A Java Interface Iterators Using the ADT Dictionary A Directory of Telephone.
Sets and Maps Part of the Collections Framework. The Set interface A Set is unordered and has no duplicates Operations are exactly those for Collection.
CS-2851 Dr. Mark L. Hornick 1 Tree Maps and Tree Sets The JCF Binary Tree classes.
Jan 12, 2012 Introduction to Collections. 2 Collections A collection is a structured group of objects Java 1.2 introduced the Collections Framework Collections.
The Daikon system for dynamic detection of likely invariants MIT Computer Science and Artificial Intelligence Lab. 16 January 2007 Presented by Chervet.
Copyright © 2002, Systems and Computer Engineering, Carleton University Hashtable.ppt * Object-Oriented Software Development Unit 8.
Abstract Data Types. What’s on the menu? What’s an abstract data type? How do you implement it? ADT List.
Lab 7 Queue ADT. OVERVIEW The queue is one example of a constrained linear data structure. The elements in a queue are ordered from least recently added.
Презентацію виконала: Суботіна О.Ф., учитель німецької мови Черкаської СШ №28 Черкаської міської ради 2014 р.
CS261 Data Structures Maps (or Dictionaries). Goals Introduce the Map(or Dictionary) ADT Introduce an implementation of the map with a Dynamic Array.
Sets and Maps Computer Science 4 Mr. Gerb Reference: Objective: Understand the two basic applications of searching.
Stack Implementations Chapter 6 Copyright ©2012 by Pearson Education, Inc. All rights reserved.
Lab 6 Stack ADT. OVERVIEW The stack is one example of a constrained linear data structure. In a stack, the elements are ordered from most recently added.
Copyright (c) Systems and Computer Engineering, Carleton University * Object-Oriented Software Development Unit 13 The Collections Framework.
Sets and Maps Part of the Collections Framework. 2 The Set interface A Set is unordered and has no duplicates Operations are exactly those for Collection.
Print Row Function void PrintRow(float x[ ][4],int i) { int j; for(j=0;j
1 Maps, Stacks and Queues Maps Reading:  2 nd Ed: 20.4, 21.2, 21.7  3 rd Ed: 15.4, 16.2, 16.7 Additional references: Online Java Tutorial at
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter Chapter 18 List ADT Animated Version.
Sogang Univ. Software Systems Engineering Lab C Programming (Chap15. 파일 입출력 )
CSE 143 Lecture 11: Sets and Maps reading:
Int fact (int n) { If (n == 0) return 1; else return n * fact (n – 1); } 5 void main () { Int Sum; : Sum = fact (5); : } Factorial Program Using Recursion.
Strukturen 3B.1 LEKTION 3B © 2014 by Vista Higher Learning, Inc. All rights reserved. 3B.1-1 Modals Startblock In both English and German, modal verbs.
Modals Startblock In both English and German, modal verbs modify the meaning of another verb. © 2014 by Vista Higher Learning, Inc. All rights reserved.
Entschuldigung. Sorry..
Efficiency of in Binary Trees
COMPUTER 2430 Object Oriented Programming and Data Structures I
Redesign Firmen-Websites
Ruf uns an Wenn Ihre Office-Apps abgestürzt sind, machen Sie sich keine Sorgen, denn wir sind mit unserem Experten-Team unterwegs, das.
Wie hilft Windows 7 Tech Support Nummer allgemeinen PC-Benutzern?
משרד התעשייה, המסחר והתעסוקה פעולות המשרד לעידוד מגזר המיעוטים
Copyright ©2012 by Pearson Education, Inc. All rights reserved
COMPUTER 2430 Object Oriented Programming and Data Structures I
COMPUTER 2430 Object Oriented Programming and Data Structures I
Maps "He's off the map!" -Stan (Mark Ruffalo) Eternal Sunshine of the Spotless Mind.
EE 422C Sets.
Windows 10 Support Nummer Warum sollten Sie die Windows 10 Support Nummer annehmen? Um herauszufinden, wie technische.
For more information: The best support MSOffice with www office com setup Mit Office.
Best Software Download & Install
For more information: Now MS office software with www. Office. com/setup.
Hashing in java.util
LABORATORY OF PROCESS ENGINEERING
MS Office Upgrade Unterstutzung Aktualisieren Sie Office für Microsoft automatisch So aktualisieren Sie Office.
MICROSOFT WORD NEU Eigenschaften IM Büro 2013 Gebührenfreie Nummer :
Copyright ©2012 by Pearson Education, Inc. All rights reserved
Presentation transcript:

1 Helmut Schauer Educational Engineering Lab Department for Informatics University of Zurich Algorithmen und Datenstrukturen FS 2008 Hashtabellen

2 Helmut Schauer Educational Engineering Lab Department for Informatics University of Zurich Dictionary Problem Mit einem Schlüssel (key) versehene Eintragungen sollen so gespeichert werden, dass sie aufgrund ihres Schlüssels effizient wiedergefunden werden können.

3 Helmut Schauer Educational Engineering Lab Department for Informatics University of Zurich Schnittstelle boolean isEmpty() int size() void clear() Object put(Object key, Object value) Object get(Object key) boolean containsKey(Object key) Object remove(Object key)

4 Helmut Schauer Educational Engineering Lab Department for Informatics University of Zurich Offene Hashverfahren h(key)...Hashfunktion 0h(key)<N k(key)...Kollisionsfunktion 0<k(key) put("Max","12345"); i = h("Max") 0 1 i N-1 "Max""12345"

5 Helmut Schauer Educational Engineering Lab Department for Informatics University of Zurich Eintragen von key und value Object put(Object key, Object value) { int i = hash(key); int k = coll(key); while (tab[i].isTaken()) i = (i+k)%N; if (tab[i].isEmpty()) { if (n>=N-1) return null; // table full else n++; } tab[i] = new Entry(key,value); return tab[i]; }

6 Helmut Schauer Educational Engineering Lab Department for Informatics University of Zurich Aufsuchen von key Object get(Object key) { int i = hash(key); int k = coll(key); while (!tab[i].isEmpty()&!tab[i].key.equals(key)) i = (i+k)%N; if (tab[i].isEmpty()) return null; // not found else return tab[i].value; // found }

7 Helmut Schauer Educational Engineering Lab Department for Informatics University of Zurich Hashfunktion hash(key) = key%N Kollisionsbehandlung linear:coll(key) = 1 double hash: coll(key) = 1+key%(N-2) N prim N und coll(key) teilerfremd

8 Helmut Schauer Educational Engineering Lab Department for Informatics University of Zurich Komplexität für offene Hashverfahren Belegungsgrad = n/N0 <1 Einfügen:E( ) = i = 1/(1- ) O(1) Aufsuchen:A( ) = 1/ 1/(1-x)dx = 1/ ln(1/(1- )) O(1) zB: 80% gefüllte Hashtabelle = 0.8 E(0.8) = 5 A(0.8) 2

9 Helmut Schauer Educational Engineering Lab Department for Informatics University of Zurich Hashverfahren mit Verkettung 0 1 i N-1

10 Helmut Schauer Educational Engineering Lab Department for Informatics University of Zurich Komplexität für Hashverfahren mit Verkettung Belegungsgrad = n/N0 Einfügen:E( ) = 1 O(1) Aufsuchen:A( ) = 1+ /2 O(1)