MIT6_851S10_lec14

MIT6_851S10_lec14 - 6.851: Advanced Data Structures Spring...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon

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

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 6.851: Advanced Data Structures Spring 2010 Lecture 14 — March 30, 2010 Prof. Andr´ e Schulz 1 Overview In the last lecture we covered the Separator Decomposition, which rearranges any tree into a balanced tree, and the ART/leaf-trimming Decomposition, which is a tree decomposition used to solve the marked ancestor problem and decremental connectivity problem. In this lecture we talk about solutions to the static and dynamic dictionary problem . Our goal is to store a small set S = { 1 , 2 ,...,n } of keys from a large universe U , with perhaps some information associated to every key. We want to find a compact data structure with low pre-processing time that will support Query( x ) in the static case and Query( x ), Insert( x ), and Delete( x ) in the dynamic case. Query( x ) checks if x ∈ S , and returns any information associated with x . In particular, FKS hashing achieves O (1) worst-case query time with O ( n ) expected space and takes O ( n ) construction time for the static dictionary problem. Cuckoo Hashing achieves O ( n ) space, O (1) worst-case query and deletion time, and O (1) amortized insertion time for the dynamic dictionary problem. 2 Hashing with Chaining Our first attempt at a dictionary data structure is hashing with chaining . We find a hash function h : U → { 1 , 2 ,...,m } , and maintain a table T with m rows, where T [ j ] = a linked list (or chain) of { x ∈ S : h ( x ) = j } . P | T [ j ] | 2 Key look up takes 2 P | T j | expected time, so we want to make the chains as equal as possible. We also generally want h to be easy to evaluate. Luckily, such hash functions exist 1 : 2.1 Universal Hashing Definition 1. A class of functions H is c-universal if and only if for all x = y , |H| . |{ h ∈ H : h ( x ) = h ( y ) }| ≤ c · m In particular, if h is picked at random from H , Pr [ h ( x ) = h ( y )] ≤ c . m We assume for the rest of this section that m = O ( n ). 1 It’s worth noting that a random function from U to { 1 ,...,m } would actually have O(1) expected query time (provided n = O ( m )). However, such a random function would be infeasibly inefficient to store and evaluate. 1 Define Z x := |{ y ∈ S : h ( x ) = h ( y ) }| , namely, the collisions with x in the set of elements we want to store. We can also write this as Z x = y δ h ( x ) ,h ( y ) , where δ is the Kronecker delta ( δ a,b = 1 if a = b and otherwise). The average query time is simply E [ Z x ], and we have nc E [ Z x ] =...
View Full Document

This note was uploaded on 03/31/2011 for the course EECS 6.851 taught by Professor Erikdemaine during the Spring '10 term at MIT.

Page1 / 6

MIT6_851S10_lec14 - 6.851: Advanced Data Structures Spring...

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online