# Register now to access 7 million high quality study materials (What's Course Hero?) Course Hero is the premier provider of high quality online educational resources. With millions of study documents, online tutors, digital flashcards and free courseware, Course Hero is helping students learn more efficiently and effectively. Whether you're interested in exploring new subjects or mastering key topics for your next exam, Course Hero has the tools you need to achieve your goals.

1 Page

### Hausuebung_10_Hashtabellen

Course: HKJLHKJL 565, Spring 2009
School: University of Graz
Rating:

#### Document Preview

MatNr. HausuebungNr.10Hastabellen DatenstrukturenAlgorithmen 11.02.2008 Angabe i A[i] 0 6 19 1 3 16 2 9 22 3 0 13 4 3 16 5 6 19 6 0 13 Bsp1 A[i] % 5 4 1 2 3 1 i 0 1 2 16 22 16 Kollision 3 13 4 19 Bsp2 - linear probing A[i] % 5 4 1 2 3 1 2 3 4 0 4 19 A[i] A[i] A[i] A[i] + + + + 1 2 3 4 i 0 16 1 16 2 22 3 13 Bsp3 quadratic - probing f(i) = 3i^3+2i^2+i h(w,i) i 0 4 0 13 6 2 1 22 34 1 2 16 102 0 3 228...

Register Now

#### Unformatted Document Excerpt

Coursehero

Course Hero has millions of student submitted documents similar to the one
below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.

Course Hero has millions of student submitted documents similar to the one below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.
MatNr. HausuebungNr.10Hastabellen DatenstrukturenAlgorithmen 11.02.2008 Angabe i A[i] 0 6 19 1 3 16 2 9 22 3 0 13 4 3 16 5 6 19 6 0 13 Bsp1 A[i] % 5 4 1 2 3 1 i 0 1 2 16 22 16 Kollision 3 13 4 19 Bsp2 - linear probing A[i] % 5 4 1 2 3 1 2 3 4 0 4 19 A[i] A[i] A[i] A[i] + + + + 1 2 3 4 i 0 16 1 16 2 22 3 13 Bsp3 quadratic - probing f(i) = 3i^3+2i^2+i h(w,i) i 0 4 0 13 6 2 1 22 34 1 2 16 102 0 3 228 4 4 19 16 Kollision Bsp4 - double Hashing i A[i] h2(k) h1(k) h1(k)+i*h2(k) h(w) i 0 19 2 4 4 4 0 1 16 2 1 3 3 1 22 2 22 2 2 6 1 2 16 3 13 2 3 9 4 3 16 4 16 2 1 9 4 4 19 13 16 Kollision Seite1von1 HaraldAltinger2008 MatNr.0630936
Find millions of documents on Course Hero - Study Guides, Lecture Notes, Reference Materials, Practice Exams and more. Course Hero has millions of course specific materials providing students with the best way to expand their education.

Below is a small sample set of documents:

University of Graz - HKJLHKJL - 565
Altinger Harald 0630936INTSUCH(von,bis,x) IF A[von] &lt; A[bis] THEN t = floor(sqrt(x-A[von]*(von^2 - bis^2) / (A[von] - A[bis]) + von^2) IF x = A[t] then RETURN t ELSE IF x &lt; A[t] THEN RETURN INTSUCH(von,t-1,x) ELSE RETURN INTSUCH(t+1,bis,x) ELSE IF x = A[
University of Graz - HKJLHKJL - 565
05AltingerHarald0630936Altinger Harald 0630936/-/funktion searches for the min branch within a binary tree /the idea is to seek per node; first all left elements, afterwards all left int seekRecursive(int currentDepth, int minLength, currentNode) cfw
University of Graz - HKJLHKJL - 565
Datenstrukturen &amp; AlgorithmenVO 708.03104.10.2007helmut.hauser@igi.tugraz.atUm was geht es?DatenstrukturenAlgorithmen04.10.2007helmut.hauser@igi.tugraz.atAlgorithmusVersuch einer Erklrung: Ein Algorithmus nimmt bestimmte Daten als Input und tran
University of Graz - HKJLHKJL - 565
Datenstrukturen &amp; AlgorithmenVO 708.031 2. Vorlesung, am 12.Okt 200611.10.2007helmut.hauser@IGI1Kleine WiederholungKennenlernen grundlegender Datenstrukturen und Algorithmen (Basis und Bausatz fr Sie). Wir wollen Algorithmen auch analysieren und unt
University of Graz - HKJLHKJL - 565
Datenstrukturen &amp; AlgorithmenVO 708.031 3. Vorlesung, am 18.Okt 2007Kleine Wiederholung Mathematische Definition von Komplexittsklassen Asymptotische Betrachtungsweise ( n O-Notation -Notation -Notation beschrnkt von oben beschrnkt von unten ) worst ca
University of Graz - HKJLHKJL - 565
Datenstrukturen &amp; AlgorithmenVO 708.031 4. Vorlesung, am 25.Okt. 200725.10.2007helmut.hauser@IGI1Kleine Wiederholung - Rekursionen Beschreibung durch Rekursionsgleichungen Lsen von Rekursionen Iteratives Einsetzen Induktion Schranken finden (siehe F
University of Graz - HKJLHKJL - 565
Datenstrukturen &amp; AlgorithmenVO 708.031 5. Vorlesung, am 08.Nov. 2007Kleine WiederholungElementare Datenstrukturen- Lineares Feld A[n] LIFO - Stapel (Stack)- Anwendungen: - Infix-Postfix - Postfix-Auswertung - Rekursionen abbilden - etc. - Schlange (
University of Graz - HKJLHKJL - 565
Datenstrukturen &amp; AlgorithmenVO 708.031 6. Vorlesung, am 15.Nov. 2007Wiederholung - HaldeEine Halde (Heap) ist ein lineares Feld A[1.n], wobei gilt:A[i] max cfw_A[2i], A[2i+1], fr i=1,2,floor(n/2) Haldenbedingung- Maximum steht an erster Position 976
University of Graz - HKJLHKJL - 565
Datenstrukturen &amp; AlgorithmenVO 708.031 7. Vorlesung, am 22.Nov. 200722.11.2007helmut.hauser@IGIAchtung: Vorlesung nchste Woche (29.Nov) fllt aus !22.11.2007helmut.hauser@IGIWiederholung Partition Zerlegen von FeldernDefinition Zerlegen: Speichere
University of Graz - HKJLHKJL - 565
Datenstrukturen &amp; AlgorithmenVO 708.031 8. Vorlesung, am 13.Dez. 200713.12.2007helmut.hauser@IGIWiederholung - QuicksortT(n) = T(k) + T(n-k) + O(n)Bester Fall:k = n/2Schlechtester Fall:k=1Minimale RekursionstiefeMaximale Rekursionstiefeworst c
University of Graz - HKJLHKJL - 565
Datenstrukturen &amp; AlgorithmenVO 708.031 9. Vorlesung, am 10.Jan. 200810.01.2008helmut.hauser@IGIWiederholungWrterbuchproblem (Suchen, Einfgen, Lschen) Eine gute Lsung: Hashtabellen (Gestreute Speicherung) Wichtig: Eine gute Hashfunktion zu haben, um
University of Graz - HKJLHKJL - 565
Datenstrukturen &amp; AlgorithmenVO 708.031 10. Vorlesung, am 17.Jan. 200817.01.2008helmut.hauser@IGIWiederholung Suchen in linearen FeldernOhne Vorsortierung Mit Vorsortierung Sequentielle Suche Speicherung nach Zugriffswahrscheinlichkeiten Selbstanord
University of Graz - HKJLHKJL - 565
Datenstrukturen &amp; AlgorithmenVO 708.031 11. Vorlesung, am 24.Jan. 200824.01.2008helmut.hauser@IGIBinrbume - WiederholungBinrbume sind spezielle Bume, welcher maximal 2 Shne haben. Knotenreihenfolgen (Symmetrische, Haupt- und Nebenreihenfolge) geordne
University of Graz - HKJLHKJL - 565
Datenstrukturen &amp; AlgorithmenVO 708.031 12. Vorlesung, am 31.Jan. 200731.01.2008helmut.hauser@IGIHinweise: Es gibt weitere Prfungstermine im Laufe des Semesters Nutzen Sie die Wartelisten Wenn Sie die Prfung nicht machen wollen, bitte abmelden! Scha
University of Graz - HKJLHKJL - 565
Insertion-Sort For i=2 to n h=A(j) j=j-1 While A(j)&gt;h and j&gt;0 Do A(j+1) = A(j) j=j-1 A(j=1)=h
University of Graz - HKJLHKJL - 565
University of Graz - HKJLHKJL - 565
Fakultaet(n) if n=1 then return 1 else return(n*Fakultaet(n-1)fibonacci(n) fib = 1 fir_1 = 1 for i = 3 to n fib_2 =fib_1 fig_1 = fib fib = fib_1 + fib_2 return fib
University of Graz - HKJLHKJL - 565
Verhalden(A,i) l-LINKS(i), r=RECHTS(i) index = i if l&lt;=n AND A[l&gt;A[i] then index=l if r&lt;=n AND A[r&gt;A[index then index=r if i!=index then vertausche(A[i],A[index]) verhalde(A,index)Baue_halde(A) for i=n/2 downto 1 verhalde(A,i)Baue_halde(A) for i=n/2 dow
University of Graz - HKJLHKJL - 565
MAXIMUM (A) return A[1] ENTFERNE_MAX (A) A[1] = A[n] n=n-1 Verhalde (A,1) EINFUEGEN (A,x) n = n+1, A[n]=x, i=n While i &gt; 1 and A[i]&gt;A[Vater(i)] do Vertausche (A[i],A[Vater(i)]) i = Vater(i)www.cosc.canterbury.ac.nz/mukundan/dsal/MinHeapAppl.htmlHEAP_SOR
University of Graz - HKJLHKJL - 565
RAND_PARTITION (A,l,r) idx = RANDOM(l,r) VERTAUSCHE(A[i],A[idx]) p = A[l] j = l-1 k = r+1 loop repeat j=j+1 until A[j] =&gt; p repeat k=k-1 until A[k] =&lt; p if j &lt; k then vertausche (A[j],A[k]) else return k QUICKSORT(A,l,r) if l &lt; r then k=PARTITION (A,l,r)
University of Graz - HKJLHKJL - 565
University of Graz - HKJLHKJL - 565
Suche (A,x) i = 0; While i &lt; n i=i+1 if (A[i] = x) RETURN i else RETURN -1BINSUCHE(von,bis,x) if von &lt;= bis then m = floor (von + bis)/2) if x = A[m] then return m else if x &lt; A[m] then m = BINSUCHE(von,m -1,x) else then m = BINSUCHE(m+1,bis,x) else m =
University of Graz - HKJLHKJL - 565
University of Graz - HKJLHKJL - 565
Simon Fraser - CS - CMPT 307
CMPT 307 Last NameThis is a sample!First Name and InitialsMidterm TestSome Day, 2009Student No. NO AIDS allowed. Answer ALL questions on the test paper. Use backs of sheets for scratch work. Total Marks: 100 1. What running times of the insertion sot
Simon Fraser - CS - CMPT 307
Simon Fraser - CS - CMPT 307
Simon Fraser - CS - CMPT 307
CMPT 307 Data Structures and Algorithms Outline Solutions to Exercises on Elementary Data Structures1. Suggest how storage for elements can be allocated and deallocated within the hash table itself by linking all unused slots into a free list. Assume tha
Simon Fraser - CS - CMPT 307
HeapsortData Structures and Algorithms Andrei BulatovAlgorithms Heapsort4-2Heap PropertyA heap is a nearly complete binary tree, satisfying an extra condition Let Parent(i) denote the parent of the vertex i Max-Heap Property: Key(Parent(i) Key(i) for
Simon Fraser - CS - CMPT 307
QuickSort and OthersData Structures and Algorithms Andrei BulatovAlgorithms Quicksort5-2Heap PropertyA heap is a nearly complete binary tree, satisfying an extra condition Let Parent(i) denote the parent of the vertex i Max-Heap Property: Key(Parent(
Simon Fraser - CS - CMPT 307
QuickSortData Structures and Algorithms Andrei BulatovAlgorithms Quicksort6-2Probability ReminderSample space Event Probability Discrete random variable: A variable that takes values with certain probability Example: The amount of money you win buyin
Simon Fraser - CS - CMPT 307
Sorting in Linear TimeData Structures and Algorithms Andrei BulatovAlgorithms Sorting in Linear Time7-2Comparison SortsThe only test that all the algorithms we have considered so far is comparison The only information we obtain about an input sequenc
Simon Fraser - CS - CMPT 307
Order StatisticsData Structures and Algorithms Andrei BulatovAlgorithms Order Statistics8-2Medians and StatisticsWe consider the following problems: - Find a minimal and maximal elements in a sequence - Find i-th smallest element in a sequence The Th
Simon Fraser - CS - CMPT 307
Queues, Stacks, Graph TraversingData Structures and Algorithms Andrei BulatovAlgorithms Queues, Stacks, Graph Traversing9-2Graph ReminderVertices and edges Nodes and arcs Representation of graphs: - adjacency matrix - adjacency lists Degrees of verti
Simon Fraser - CS - CMPT 307
Hash TablesData Structures and Algorithms Andrei BulatovAlgorithms Hash Tables10-2The Dictionary ProblemWe have a dictionary Each entry of the dictionary consists of a key, a word, and an article explaining the word We to perform several simple opera
Simon Fraser - CS - CMPT 307
Hash Tables IIData Structures and Algorithms Andrei BulatovAlgorithms Hash Tables II11-2Hash TablesIn case of collision create a list of elements with the same hash valueh(k1 ) k1k2 k4key article nexth( k 2 )key article next key article nextk3
Simon Fraser - CS - CMPT 307
Binary Search TreesData Structures and Algorithms Andrei BulatovAlgorithms Binary Search Trees12-2Binary Search TreeA binary search tree is a binary rooted tree, in which keys satisfy the Binary Search Tree property: Let x be a node in a binary searc
Simon Fraser - CS - CMPT 307
Red-Black TreesData Structures and Algorithms Andrei BulatovAlgorithms Red-Black Trees13-2Red-Black TreesAll binary search tree operations take O(h) time, where h is the height of the tree Therefore, it is important to `balance the tree so that its h
Simon Fraser - CS - CMPT 307
Algorithms RB-TreesRed-Black Trees IIData Structures and Algorithms Andrei BulatovAlgorithms RB-Trees14-2Red-Black PropertiesA binary search tree is a red-black tree if it satisfies the following red-black properties: 1. Every node is either red or
Simon Fraser - CS - CMPT 307
Greedy AlgorithmsData Structures and Algorithms Andrei BulatovAlgorithms Greedy Algorithms15-2Greed is good. Greed is right. Greed works.Wall StreetAlgorithms Greedy Algorithms15-3Interval SchedulingConsider the following problem (Interval Schedu
Simon Fraser - CS - CMPT 307
Union FindData Structures and Algorithms Andrei BulatovAlgorithms Union Find16-2Union FindIn a nutshell, Kruskals algorithm starts with a completely disjoint graph, and adds edges creating a graph with fewer and fewer connected components. Every time
Simon Fraser - CS - CMPT 307
Matrix MultiplicationData Structures and Algorithms Andrei BulatovAlgorithms Matrix Multiplication17-2Matrix MultiplicationMatrix multiplication. Given two n-by-n matrices A and B, compute C = AB.cij = aik bkjk =1 n c11 c12 c c 21 22 M M c n1 c n
Simon Fraser - CS - CMPT 307
Dynamic ProgrammingData Structures and Algorithms Andrei BulatovAlgorithms Dynamic Programming18-2Weighted Interval SchedulingWeighted interval scheduling problem. Instance A set of n jobs. Job j starts at sj, finishes at fj, and has weight or value
Simon Fraser - CS - CMPT 307
Dynamic Programming IIData Structures and Algorithms Andrei BulatovAlgorithms Dynamic Programming18-2Shortest PathSuppose that every arc e of a digraph G has length (or cost, or weight, or ) len(e) But now we allow negative lengths (weights) Then we
Simon Fraser - CS - CMPT 307
Binomial HeapsData Structures and Algorithms Andrei BulatovAlgorithms Binomial Heaps21-2Priority Queues Supports the following operations. Insert element x. Return min element. Return and delete minimum element. Decrease key of element x to k. Applic
Simon Fraser - CS - CMPT 307
Sequence AlignmentData Structures and Algorithms Andrei BulatovAlgorithms Sequence Alignment20-2Shortest Path: Finding Negative CyclesTwo questions: - how to decide if there is a negative cycle? - how to find one? Lemma It suffices to find negative c
Simon Fraser - CS - CMPT 307
CMPT 307 Data Structures and Algorithms Exercises on Heaps and Stable Matchings. Due: Thursday, September 24th (at the beginning of the class)Reminder: the work you submit must be your own. Any collaboration and consulting outside resourses must be expli
Simon Fraser - CS - CMPT 307
CMPT 307 Data Structures and Algorithms Exercises on Sorting. Due: Thursday, October 8th (at the beginning of the class)Reminder: the work you submit must be your own. Any collaboration and consulting outside resourses must be explicitely mentioned on yo
Simon Fraser - CS - CMPT 307
CMPT 307 Data Structures and Algorithms Exercises on Median and Order Statistics. Due: Thursday, October 15th (at the beginning of the class)Reminder: the work you submit must be your own. Any collaboration and consulting outside resourses must be explic
Simon Fraser - CS - CMPT 307
CMPT 307 Data Structures and Algorithms Exercises on Elementary Data Structures. Due: Thursday, October 22th (at the beginning of the class)Reminder: the work you submit must be your own. Any collaboration and consulting outside resourses must be explici
Simon Fraser - CS - CMPT 307
CMPT 307 Data Structures and Algorithms Exercises on Red-Black Trees. Due: Thursday, November 5th (at the beginning of the class)Reminder: the work you submit must be your own. Any collaboration and consulting outside resources must be explicitly mention
Simon Fraser - CS - CMPT 307
CMPT 307 Data Structures and Algorithms Exercises on Divide and Conquer. Due: Thursday, November 19th (at the beginning of the class)Reminder: the work you submit must be your own. Any collaboration and consulting outside resources must be explicitly men
Simon Fraser - CS - CMPT 307
CMPT 307 Data Structures and Algorithms Outline Solutions to Exercises on Heaps and Stable Matchings1. Describe a (n log n) time algorithm that, given a set S of n integers and another integer x, determines whether or not there exist two elements in S wh
Simon Fraser - CS - CMPT 307
CMPT 307 Data Structures and Algorithms Outline Solutions to Exercises on Sorting1. Show that the worst-case running time of Heapify-Up on a heap of size n is (log n). If the new value added to the very end of the heap is smaller than any other element o
Simon Fraser - CS - CMPT 307
CMPT 307 Data Structures and Algorithms Outline Solutions to Exercises on Sorting1. Show that the second smallest of n elements can be found with n + log n 2 comparisons in the worst case. The smallest of n numbers can be found with n 1 comparisons as fo
Simon Fraser - CS - CMPT 307
CMPT 307 Data Structures and Algorithms Outline Solutions to Exercises on Red-Black Trees1. Show that any arbitrary n-node binary search tree can be transformed into any other arbitrary n-node binary search tree using O(n) rotations. Since the exercise a
Simon Fraser - MACM - 316
1MACM 316: HOMEWORK ASSIGNMENT 2 Due Date: October 9, 2009Sections and Problems: 1. 2.3, # 16, 19, 34 2. 2.4, # 8, 10 3. 2.5, # 2, 10 (except section 2.1 comparison), 12b 4. 2.6, # 2f, 5a 5. 3.1, # 2b, 4b, 6b 6. 3.2, # 4b, 10, 20
Simon Fraser - MACM - 316
1MACM 316: HOMEWORK ASSIGNMENT 2 Due Date: October 26, 2009 (by Noon)Sections and Problems: 3.3 3.4 6.1 # 6a, 10 # 4c, 6c, 12, 29 # 6bc, 10Write your own Gaussian elimination program, and modify it to use partial pivoting as discussed in class. Use bot
Simon Fraser - MACM - 316
1MACM 316: HOMEWORK ASSIGNMENT 4 Due Date: November 11, 2009 (by Noon)Sections and Problems: 6.5 # 6a, 10In the last assignment, you used your Gaussian elimination program to solve the problem Hx = b, where H is the 8 8 matrix. H = (hij := 1 ), i+j1 i,
Simon Fraser - CMPT - 307
CMPT 300 Assignment 1 (4%)Submit your written solutions and code by Thursday, October 1, 2009 5:00pm. Late assignments will receive 0/80. In all questions, use appropriate justication and explanations using complete sentences.1. [20 marks] Consider a si
Simon Fraser - CMPT - 307
CMPT 300 Assignment 2 (8.5%)Return your solutions to the assignment boxes by Thursday, October 15, 2009 5:00pm.1. [10 marks] Tannenbaum: Chapter 1, Question 7. 2. [10 marks] Tannenbaum: Chapter 2, Question 35. 3. [10 marks] Tannenbaum: Chapter 2, Questi