• Keine Ergebnisse gefunden

Listing A.6: d-cuckoo.cpp

1 // //////////////////////////////////////////////////////////

// d Cuckoo Hashing L i b r a r y // by Reinhard K u t z e l n i g g

// bug r e p o r t s and comments t o k u t z e l n i g g @ d m g . t u w i e n . ac . a t

5 // www . dmg . t u w i e n . ac . a t / k u t z e l n i g g

// l a s t u p d a t e d : $Date : 2008/06/29 0 7 : 2 4 : 1 8 $ // d i s t r i b u t e d under t h e c o n d i t i o n s o f t h e LGPL

// //////////////////////////////////////////////////////////

10 template<c l a s s S> H a s h d c u c k<S>: : H a s h d c u c k (i n t m, i n t d , bool s e p a r a t e , i n t maxloop ) {

H a s h d c u c k : : m = m;

H a s h d c u c k : : maxloop = maxloop ;

15 H a s h d c u c k : : s e p a r a t e = s e p a r a t e ; i f( d > 1 2 6 )

d = 1 2 6 ;

H a s h d c u c k : : d = d ; n = 0 ;

20 t a b l e = new S[m ] ; s t a t u s = new i n t[m ] ; hv = new uint[ d ] ;

f o r (i n t i =0 ; i<m ; i ++)

25 {

s t a t u s [ i ] = 1;

} }

30

template<c l a s s S> H a s h d c u c k<S>: : ˜ H a s h d c u c k ( ) {

d e l e t e[ ] t a b l e ; d e l e t e[ ] s t a t u s ;

35 d e l e t e[ ] hv ; }

template<c l a s s S> i n t H a s h d c u c k<S>: : s e a r c h (S s )

40 {

f o r (i n t i =0 ; i<d ; i ++) {

i f ( s t a t u s [ h ( s , i )]>=0 && t a b l e [ h ( s , i )]== s ) return i +1;

45 }

return d ; }

50 template<c l a s s S> i n t H a s h d c u c k<S>: : i n s e r t (S s ) {

S p , q=s ; i n t i , j ; i n t n r q ;

55 i n t n r p ; hv [ 0 ] = h ( q , 0 ) ;

i f ( s t a t u s [ hv [ 0 ] ] == 1)

{ // f i r s t i n s p e c t e d c e l l i s empty

60 t a b l e [ hv [ 0 ] ] = q ; s t a t u s [ hv [ 0 ] ] = 0 ; n++;

return 1 ; }

65

A Selected C++ code listings

f o r ( j =1 ; j !=d ; j ++) {

hv [ j ] = h ( q , j ) ;

i f ( s t a t u s [ hv [ j ] ] == 1 | | t a b l e [ hv [ j ]]== q )

70 { // f o u n d an empty c e l l o r q a l r e a d y i n t a b l e t a b l e [ hv [ j ] ] = q ;

s t a t u s [ hv [ j ] ] = j ; n++;

return 1+ j ;

75 }

}

// a l l p o s s i b l e c e l l s f o r q a r e o c c u p i e d p = t a b l e [ hv [ 0 ] ] ; // p w i l l b e k i c k e d o u t n r p = s t a t u s [ hv [ 0 ] ] ;

80 t a b l e [ hv [ 0 ] ] = q ; s t a t u s [ hv [ 0 ] ] = 0 ; q = p ;

n r q = ( n r p +1) % d ;

85 f o r ( i =1; i<maxloop ; i ++) {

f o r ( j=n r q ; j != n r p ; j =( j +1)%d ) {

hv [ j ] = h ( q , j ) ;

90 i f ( s t a t u s [ hv [ j ] ] ==1 | | t a b l e [ hv [ j ]]== q ) { // f o u n d an empty c e l l o r q a l r e a d y i n t a b l e

t a b l e [ hv [ j ] ] = q ; s t a t u s [ hv [ j ] ] = j ; n++;

95 i n t s t e p s = j n r q + 1 ;

i f ( s t e p s < 0 ) s t e p s += d ;

return i( d1)+1+ s t e p s ; }

100 }

// a l l p o s s i b l e c e l l s f o r q a r e o c c u p i e d p = t a b l e [ hv [ n r q ] ] ; // p w i l l b e k i c k e d o u t

n r p = s t a t u s [ hv [ n r q ] ] ; t a b l e [ hv [ n r q ] ] = q ;

105 s t a t u s [ hv [ n r q ] ] = n r q ; q = p ;

n r q = ( n r p +1) % d ; }

return maxloop( d1)+1;

110 // r e h a s h r e q u i r e d , i n s e r t i o n n o t p o s s i l e }

template<c l a s s S> void H a s h d c u c k<S>: : d e l (S s )

115 {

i n t r = s e a r c h ( s ) ; i f ( r >= 0 )

{

s t a t u s [ h ( s , r ) ] = 1;

120 n−−;

} }

125 template<c l a s s S> void H a s h d c u c k<S>: : o u t ( s t d : : o s t r e a m s t r e a m ) {

i n t i , j ;

s t r e a m << ∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗\n” ;

130 s t r e a m << ”n=” << n << m=” <<m<< d=” << d << \n” ;

A.6 d-cuckoo.cpp

f o r ( i =0; i<m && i<100; i +=7) {

f o r ( j=i ; j<i +7 && j<m; j ++)

135 {

stream>width ( 1 2 ) ;

s t r e a m ; }s t r e a m << \n” ;

140

f o r ( j=i ; j<i +7 && j<m; j ++) {

stream>width ( 1 2 ) ; i f ( s t a t u s [ j ] < 0 )

145 s t r e a m << ” ” ;

e l s e

s t r e a m << t a b l e [ j ] ; }s t r e a m << \n” ;

150 f o r ( j=i ; j<i +7 && j<m; j ++) {

stream>width ( 1 2 ) ;

s t r e a m << s t a t u s [ j ] ; }

155 s t r e a m << \n\n” ; } }

160 template<c l a s s S> uint H a s h d c u c k<S>: : o c c u p a n c y ( ) {

uint i ; i n t p ; uint o ;

165 o = new uint[ d ] ; f o r ( i =0 ; i<d ; i ++)

o [ i ] = 0 ;

f o r ( i =0 ; i<m ; i ++) {

170 p = s t a t u s [ i ] ; i f ( p >= 0 )

o [ p]++;

}

return o ;

175 }

// /////////////////////////////////////////////////////

// /////////////////////////////////////////////////////

180

H a s h d c u c k p o l : : H a s h d c u c k p o l

(i n t m, i n t d , bool s e p a r a t e , i n t maxloop , RandBase random ) : H a s h d c u c k<uint>(m, d , s e p a r a t e , maxloop )

185 {

a = new uint[ d ] ; b =new uint[ d ] ;

i f ( s e p a r a t e )

190 M = m/d ;

e l s e M = m;

f o r (i n t i =0 ; i<d ; i ++)

195 {

a [ i ] = random>g e t (1< <31);

b [ i ] = random>g e t (1< <31);

A Selected C++ code listings

} }

200

H a s h d c u c k p o l : : ˜ H a s h d c u c k p o l ( ) {

d e l e t e[ ] a ;

205 d e l e t e[ ] b ; }

// /////////////////////////////////////////////////////

210 // /////////////////////////////////////////////////////

H a s h d c u c k c w : : H a s h d c u c k c w

(i n t m, i n t d , bool s e p a r a t e , i n t maxloop , RandBase random )

215 : H a s h d c u c k<uint>(m, d , s e p a r a t e , maxloop ) {

i f ( s e p a r a t e ) M = m/d ; e l s e

220 M = m;

r = new i n t[ d ] ;

f o r (i n t j =0 ; j<d ; j ++) {

r [ j ] = new i n t[ 1 2 8 ] ;

225 f o r (i n t i =0 ; i<128 ; i ++) {

r [ j ] [ i ] = random>g e t (1< <31);

} }

230 }

H a s h d c u c k c w : : ˜ H a s h d c u c k c w ( ) {

235 f o r (i n t j =0 ; j<d ; j ++) {

d e l e t e[ ] r [ j ] ; }

d e l e t e[ ] r ;

240 }

i n l i n e i n t H a s h d c u c k c w : : h (uint s , i n t nr ) {

245 i n t addr = 1;

uint h = 0 ;

f o r (uint i =0 ; i<8 ; i ++) {

h ˆ= r [ nr ] [ addr += 1 + ( s & 0xF ) ] ;

250 s >>= 4 ; }

return h % M + s e p a r a t enrM; ; }

255

// /////////////////////////////////////////////////////

// /////////////////////////////////////////////////////

260 H a s h d c u c k s i m : : H a s h d c u c k s i m

(i n t m, i n t d , i n t n end , bool s e p a r a t e , RandBase random )

: H a s h d c u c k<uint>( s e p a r a t e ? d(m/d ) : m, d , s e p a r a t e , dn e n d +1) {

A.6 d-cuckoo.cpp

H a s h d c u c k s i m : : n e n d = n e n d ;

265 hv = new uint[ d ] ; i f( ! s e p a r a t e ) {

f o r (i n t j =0 ; j<d ; j ++)

270 {

hv [ j ] = new uint[ n e n d ] ; f o r (i n t i =0 ; i<n e n d ; i ++) {

hv [ j ] [ i ] = random>g e t (m) ;

275 }

} } e l s e {

280 f o r (i n t j =0 ; j<d ; j ++) {

hv [ j ] = new uint[ n e n d ] ; f o r (i n t i =0 ; i<n e n d ; i ++) {

285 hv [ j ] [ i ] = random>g e t (m/d ) + j(m/d ) ; } }

} }

290

H a s h d c u c k s i m : : ˜ H a s h d c u c k s i m ( ) {

f o r (i n t j =0 ; j<d ; j ++)

295 {

d e l e t e[ ] hv [ j ] ; }

d e l e t e[ ] hv ; }

A Selected C++ code listings

Listing A.7: tables.hpp

1 // //////////////////////////////////////////////////////////

// ( B i p a r t i t e ) D i s j o i n t S e tF o r e s t L i b r a r y // by Reinhard K u t z e l n i g g

// bug r e p o r t s and comments t o k u t z e l n i g g @ d m g . t u w i e n . ac . a t

5 // www . dmg . t u w i e n . ac . a t / k u t z e l n i g g

// l a s t u p d a t e d : $Date : 2007/09/24 0 7 : 5 7 : 5 1 $ // d i s t r i b u t e d under t h e c o n d i t i o n s o f t h e LGPL

// //////////////////////////////////////////////////////////

10 // R e f e r e n c e s :

// T. C. Cormen , C. E . L e i s e r s o n , and R. L . R i v e s t , // I n t r o d u c t i o n t o A l g o r i t h m s , MIT P r e s s , London , 2 0 0 0 .

#i f n d e f TABLES HPP

15#define TABLES HPP

#include <m a l l o c . h>

c l a s s T a b l e s

20 {

bool b i p a r t i t e ; i n t s e t 1 ; i n t s i z e 1 ; bool c y c l i c 1 ;

25 i n t s e t 2 ; i n t s i z e 2 ; bool c y c l i c 2 ; public:

30 T a b l e s (i n t m, i n t m2= 0 ) ;

˜ T a b l e s ( ) ;

// r e t u r n s t h e p a r e n t o f u i n t p a r e n t (i n t u ) ;

35

// u n i o n s t h e components w i t h r o o t s u and v ( new r o o t v ) void merge (i n t u , i n t v ) ;

// r e t u r n s t h e s i z e o f t h e component c o n t a i n i n g u , o n l y f o r r o o t n o d e s !

40 i n t g e t s i z e (i n t u ) ;

// s e t s t h e s i z e o f t h e component w i t h r o o t u t o s void s e t s i z e (i n t u , i n t s ) ;

45 // r e t u r n s i f u i s i n a c y c l e , u s e o n l y f o r r o o t n o d e s ! i n t g e t c y c l i c (i n t u ) ;

// marks t h e component w i t h r o o t u a s c y c l i c void s e t c y c l i c (i n t u ) ;

50

// r e t u r n s t h e r o o t node o f u i n t f i n d s e t (i n t u ) ;

void operator new( s i z e t s ) { return m a l l o c ( s ) ; }

55 void operator d e l e t e(void p ) { f r e e ( p ) ; } };

#e n d i f /TABLES HPP /

A.8 tables.cpp

Listing A.8: tables.cpp

1 // //////////////////////////////////////////////////////////

// B i p a r t i t e D i s j o i n t S e tF o r e s t L i b r a r y // by Reinhard K u t z e l n i g g

// bug r e p o r t s and comments t o k u t z e l n i g g @ d m g . t u w i e n . ac . a t

5 // www . dmg . t u w i e n . ac . a t / k u t z e l n i g g

// l a s t u p d a t e d : $Date : 2008/07/07 1 4 : 5 7 : 4 9 $ // d i s t r i b u t e d under t h e c o n d i t i o n s o f t h e LGPL

// //////////////////////////////////////////////////////////

10#include ” t a b l e s . hpp”

T a b l e s : : T a b l e s (i n t m, i n t m2) {

i f (m2<= 0 )

15 b i p a r t i t e = f a l s e; e l s e

b i p a r t i t e = true; s e t 1 = new i n t[m+ 1 ] ;

20 s i z e 1 = new i n t[m+ 1 ] ; c y c l i c 1 =new bool[m+ 1 ] ; f o r (i n t j =1 ; j<m+1 ; j ++) {

25 s e t 1 [ j ] = j ; s i z e 1 [ j ] = 1 ; c y c l i c 1 [ j ] = f a l s e; }

30 i f( b i p a r t i t e ) {

s e t 2 = new i n t[ m2+ 1 ] ; s i z e 2 = new i n t[ m2+ 1 ] ; c y c l i c 2 = new bool[ m2+ 1 ] ;

35

f o r (i n t j =1 ; j<m2+1 ; j ++) {

s e t 2 [ j ] =j ; s i z e 2 [ j ] = 1 ;

40 c y c l i c 2 [ j ] = f a l s e; } }

}

45 T a b l e s : : ˜ T a b l e s ( ) {

d e l e t e[ ] s e t 1 ; d e l e t e[ ] s i z e 1 ; d e l e t e[ ] c y c l i c 1 ;

50

i f ( b i p a r t i t e ) {

d e l e t e[ ] s e t 2 ; d e l e t e[ ] s i z e 2 ;

55 d e l e t e[ ] c y c l i c 2 ; } }

60 i n t T a b l e s : : p a r e n t (i n t u ) {

i f ( u > 0 )

{ // f i r s t t a b l e return s e t 1 [ u ] ;

65 }

A Selected C++ code listings

// s e c o n d t a b l e return s e t 2 [u ] ; }

70

void T a b l e s : : merge (i n t u , i n t v ) {

i f ( u > 0 )

{ // f i r s t t a b l e

75 s e t 1 [ u ] = v ; return; }

// s e c o n d t a b l e s e t 2 [u ] = v ;

80 }

i n t T a b l e s : : g e t s i z e (i n t u ) {

85 i f ( u>0)

{ // f i r s t t a b l e return s i z e 1 [ u ] ; }

// s e c o n d t a b l e

90 return s i z e 2 [u ] ; }

void T a b l e s : : s e t s i z e (i n t u , i n t s )

95 {

i n t h ; i f ( u>0)

{ // f i r s t t a b l e

100 h = s i z e 1 [ u ] ; s i z e 1 [ u ] = s ; return; }

// s e c o n d t a b l e

105 h = s i z e 2 [u ] ; s i z e 2 [u ] = s ; }

110 i n t T a b l e s : : g e t c y c l i c (i n t u ) {

i f ( u>0)

{ // f i r s t t a b l e return c y c l i c 1 [ u ] ;

115 }

return c y c l i c 2 [u ] ; }

120 void T a b l e s : : s e t c y c l i c (i n t u ) {

i n t h ; i f ( u>0)

125 { // f i r s t t a b l e h = c y c l i c 1 [ u ] ;

c y c l i c 1 [ u ] = true; return;

}

130 // s e c o n d t a b l e h = c y c l i c 2 [u ] ;

A.8 tables.cpp

c y c l i c 2 [u ] = true; }

135

i n t T a b l e s : : f i n d s e t (i n t u ) { // s t a n d a r d v e r s i o n

while ( p a r e n t ( u ) != u )

140 u = p a r e n t ( u ) ; return u ;

} /

145 i n t T a b l e s : : f i n d s e t ( i n t u ) { // s h o r t e n p a t h l e n g t h

i n t v = p a r e n t ( u ) ; i n t w = u ;

i f ( v != u )

150 {

w = f i n d s e t ( v ) ; merge ( u , w ) ; }

r e t u r n w ;

155 }

/

Appendix B

Selected Maple worksheets

In this chapter, we present some of the most important Maple worksheets used to perform the calculations decribed in the previous chapters. All files (and some others) are included on the attached CD-ROM.

In general, each worksheet starts with the derivation of the saddle point theorem that is required to obtain the desired results. After this initial calculation, the actual derivation of special results start. At this point, is should be easy to exchange the involved functions and hence adopt the worksheet to perform different calculations that are however based on the same saddle point method.

(1.1)

substitution(1.2) (2.1)

integration

B.1 asym main one.mw

B.1 asym main one.mw

(3.2) (41)

(3.1)

output expansion definition of funtions f and g, calculation of cummulants

(4.1) (4.2)

B Selected Maple worksheets

(5.2)

(4.3) (5.1) (5.3)

asymptotic (main result) additional calculations

(6.1) probabilities

B.1 asym main one.mw

(1.3)

(1.2)

(1.1)

calculations for variable − substitution (1.4)

(1.3) substitution

B Selected Maple worksheets

B.2 asym main.mw

(3.1)

integration (5.1)

definition of funtions f and g, calculation of cummulants

B.2 asym main.mw

(5.2) (6.1)

asymptotic (main result)

(6.3)

(6.2) (7.1)

additional calculations

B Selected Maple worksheets

probabilities

B.2 asym main.mw

(1.3)

(1.1) (1.2)

calculations for variable substitution

(1.3) (1.4) variable substitution

B Selected Maple worksheets

B.3 asym main asymmetric.mw

(3.1)

integration

(4.1) (5.1)(4.4)(4.2) (4.3)

calculate x0 and y0 (saddle point) definition of funtions f and g, calculation of cummulants

B.3 asym main asymmetric.mw

(5.3)

(5.2)

(6.1) (6.3)(6.2) (6.4)

asymptotic (main result)

B Selected Maple worksheets

(6.6)

(6.5) (7.1)

calculate failure probability

(7.2) (7.3) calculate max. n depending on c

B.3 asym main asymmetric.mw

(8.2)

(8.1) probabilities

B Selected Maple worksheets

Index

Brent’s variation, 4, 94, 104

Cauchy’s Integral Formula, 20, 22, 26 chaining

Index

with chaining, 5, 6, 14 direct, 5

separate, 5

with open addressing, 2, 6 hypergraph, 10

insertion operation, 85 key, 1

Lagrange inversion, 39

Lagrange Inversion Theorem, 17 Laplace transform, 19

Laplace’s method, 21

moment generating function, 19 multigraph, 33

polynomial hash function, 14 probe sequence, 2

probing linear, 3 quadratic, 3 uniform, 3 random number, 109 saddle point, 20

asymmetric cuckoo hashing, 44 method, 20

simplified cuckoo hashing, 36 standard cuckoo hashing, 41 search operation, 99

skip list, 1

Stirling’s formula, 21 tail

completition, 21 integrals, 21 tree

bipartite, 38

rooted labelled, 38 unrooted labelled, 38 function, 34

rooted labelled, 34 unrooted labelled, 34

Bibliography

Milton Abramowitz and Irena A. Stegun, editors. Handbook of Mathematical Functions.

Dover Publications, Washington, DC, 1970.

Tsiry Andriamampianina and Vlady Ravelomanana. Enumeration of connected uniform hypergraphs. In FPSAC 05, 2005.

Nikolas Askitis. Efficient Data Structures for Cache Architectures. PhD thesis, School of Computer Science and Information Technology, RMIT University, Australia, August 2007.

Yossi Azar, Andrei Z. Broder, Anna R. Karlin, and Eli Upfal. Balanced allocations.

SIAM J. Comput., 29(1):180–200, 1999.

Andrew Binstock. Hashing rehashed: Is ram speed making your hashing less efficient?

Dr. Dobb’s Journal, 4(2), 1996.

John R. Black, Charles U. Martel, and Hongbin Qi. Graph and hashing algorithms for modern architectures: Design and performance. In WAE ’92, Saarbr¨ucken, Germany, August 20-22, 1998, Proceedings, pages 37–48. Max-Planck-Institut f¨ur Informatik, 1998.

Jonah Blasiak and Rick Durrett. Random oxford graphs. Stochastic Process. Appl., 115 (8):1257–1278, 2005.

B´ela Bollob´as. Random Graphs. Cambridge University Press, Cambridge, UK, second edition, 2001.

Richard P. Brent. Reducing the retrieval time of scatter storage techniques. Commun.

ACM, 16(2):105–109, 1973.

Andrei Z. Broder and Michael Mitzenmacher. Using multiple hash functions to improve ip lookups. InINFOCOM, pages 1454–1463, 2001.

Larry Carter and Mark N. Wegman. Universal classes of hash functions. J. Comput.

Syst. Sci., 18(2):143–154, 1979.

Pedro Celis, Per-˚Ake Larson, and J. Ian Munro. Robin hood hashing (preliminary report).

In26th Annual Symposium on Foundations of Computer Science, 21-23 October 1985, Portland, Oregon, USA, pages 281–288. IEEE, 1985.

Bibliography

John B. Conway. Functions of One Complex Variable. Springer, New York, second edition, 1978.

Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest, and Clifford Stein. Introduc-tion to Algorithms. MIT Press, Cambridge, Mass., London, England, second ediIntroduc-tion, 2001.

Zbigniew J. Czech, George Havas, and Bohdan S. Majewski. Perfect hashing. Theoretical Computer Science, 182(1-2):1–143, 1997.

Jurek Czyzowicz, Wojciech Fraczak, and Feliks Welfed. Notes about d-cuckoo hashing.

Technical Report RR 06/05-1, Universit´e du Qu´ebec en Outaouais, 2006.

Ketan Dalal, Luc Devroye, Ebrahim Malalla, and Erin McLeis. Two-way chaining with reassignment. SIAM J. Comput., 35(2):327–340, 2005.

Luc Devroye and Pat Morin. Cuckoo hashing: Further analysis. Information Processing Letters, 86(4):215–219, 2003.

Reinhard Diestel. Graph Theory. Springer, Berlin, 2005.

Martin Dietzfelbinger and Christoph Weidling. Balanced allocation and dictionaries with tightly packed constant size bins. Theoretical Computer Science, 380(1-2):47–68, 2007.

Martin Dietzfelbinger and Philipp Woelfel. Almost random graphs with simple hash functions. In STOC ’03: Proceedings of the thirty-fifth annual ACM symposium on Theory of computing, pages 629–638. ACM, 2003.

Martin Dietzfelbinger, Joseph Gil, Yossi Matias, and Nicholas Pippenger. Polynomial hash functions are reliable (extended abstract). InICALP ’92, volume 623 of LNCS, pages 235–246. Springer, 1992. ISBN 3-540-55719-9.

Martin Dietzfelbinger, Anna R. Karlin, Kurt Mehlhorn, Friedhelm Meyer auf der Heide, Hans Rohnert, and Robert Endre Tarjan. Dynamic perfect hashing: Upper and lower bounds. SIAM J. Comput., 23(4):738–761, 1994.

Martin Dietzfelbinger, Torben Hagerup, Jyrki Katajainen, and Martti Penttonen. A reliable randomized algorithm for the closest-pair problem. J. Algorithms, 25(1):19–51, 1997.

Michael Drmota. A bivariate asymptotic expansion of coefficients of powers of generating functions. European Journal of Combinatorics, 15(2):139–152, 1994.

Michael Drmota and Reinhard Kutzelnigg. A precise analysis of cuckoo hashing.preprint, 2008.

Michael Drmota and Mich`ele Soria. Marking in combinatorial constructions: Generating functions and limiting distributions. Theoretical Computer Science, 144(1&2):67–99, 1995.

Michael Drmota and Mich`ele Soria. Images and preimages in random mappings. SIAM Journal on Discrete Mathematics, 10(2):246–269, 1997.

Bibliography

Paul Erd˝os and Alfr´ed R´enyi. On random graphs i. Publ. Math. Debrecen, 6:290–297, 1959.

Paul Erd˝os and Alfr´ed R´enyi. On the evolution of random graphs. Publ. Math. Inst.

Hungar. Acad. Sci., 5:17–61, 1960.

Paul Erd˝os and Alfr´ed R´enyi. On the evolution of random graphs. Bull. Inst. Internat.

Statist., 38:343–347, 1961.

Ulfar Erlingsson, Mark Manasse, and Frank McSherry. A cool and practical alternative´ to traditional hash tables. In WDAS ’06: 7th Workshop on Distributed Data and Structures, 2006.

Philippe Flajolet and Andrew M. Odlyzko. The average height of binary trees and other simple trees. Journal of Computer and System Sciences, 25(2):171–213, 1982.

Philippe Flajolet and Andrew M. Odlyzko. Random mapping statistics. LNCS, 434:

329–354, 1990.

Philippe Flajolet and Robert Sedgewick. An introduction to the analysis of algorithms.

Addison-Wesley, Boston, Mass., 2001.

Philippe Flajolet and Robert Sedgewick. Analytic Combinatorics, web edition. To be published by Cambridge University Press, Cambridge, UK, 2008. available from the authors web sites.

Philippe Flajolet, Donald E. Knuth, and Boris Pittel. The first cycles in an evolving graph. Discrete Mathematics, 75(1-3):167–215, 1989.

Philippe Flajolet, Zhicheng Gao, Andrew M. Odlyzko, and L. Bruce Richmond. The distribution of heights of binary trees and other simple trees.Combinatorics, Probability

& Computing, 2:145–156, 1993.

Dimitris Fotakis, Rasmus Pagh, Peter Sanders, and Paul G. Spirakis. Space efficient hash tables with worst case constant access time. InSTACS ’03, volume 2607 ofLNCS, pages 271–282. Springer, 2003.

Dimitris Fotakis, Rasmus Pagh, Peter Sanders, and Paul G. Spirakis. Space efficient hash tables with worst case constant access time. Theory Comput. Syst., 38(2):229–

248, 2005.

Michael L. Fredman, J´anos Koml´os, and Endre Szemer´edi. Storing a sparse table with O(1) worst case access time. J. ACM, 31(3):538–544, 1984.

Dani`ele Gardy. Some results on the asymptotic behaviour of coefficients of large powers of functions. Discrete Mathematics, 139(1-3):189–217, 1995.

Omer Gimenez, Anna de Mier, and Marc Noy. On the number of bases of bicircular matroids. Annals of Combinatorics, 9(1):35–45, 2005.

G. H. Gonnet and R. Baeza-Yates. Handbook of algorithms and data structures: in Pascal and C. Addison-Wesley, Boston, MA, USA, second edition, 1991. ISBN 0-201-41607-7.

Bibliography

Gaston H. Gonnet. Expected length of the longest probe sequence in hash code searching.

J. ACM, 28(2):289–304, 1981.

Gaston H. Gonnet and J. Ian Munro. The analysis of an improved hashing technique.

InConference Record of the Ninth Annual ACM Symposium on Theory of Computing, 2-4 May 1977, Boulder, Colorado, USA, pages 113–121. ACM, 1977.

I. J. Good. Saddle-point methods for the multinomial distribution. Ann. Math. Stat., 28 (4):861–881, 1957.

Ian P. Goulden and David M. Jackson. Combinatorial Enumeration. Dover, New York, 1983.

Daniel H. Greene and Donald E. Knuth. Mathematics for the Analysis of Algorithms.

Birkh¨auser, Boston, second edition, 1982.

Gregory L. Heileman and Wenbin Luo. How caching affects hashing. In ALENEX /ANALCO 2005, Vancouver, BC, Canada, 22 January 2005, pages 141–154. SIAM, 2005.

Hsien-Kuei Hwang. Large deviations for combinatorial distributions. i. central limit the-orems. Annals of Applied Probability, 6(1):297–319, 1996.

Svante Janson, Donald E. Knuth, Tomasz Luczak, and Boris Pittel. The birth of the giant component. Random Structures and Algorithms, 4(3):233–359, 1993.

Svante Janson, Tomasz Luczak, and Andrzej Rucinski. Random Graphs. Wiley, New York, 2000.

I. B. Kalugin. The number of components of a random bipartite graph. Discrete Mathe-matics and Applications, 1(3):289–299, 1991.

Alfons Kemper and Antr´e Eickler. Datenbanksysteme. Oldenburg, M¨unchen, Wien, sixth edition, 2006.

Adam Kirsch, Michael Mitzenmacher, and Udi Wieder. More robust hashing: Cuckoo hashing with a stash. In Proceedings of the 16th Annual European Symposium on Algorithms, 2008.

Donald E. Knuth.The Art of Computer Programming, Volume III: Sorting and Searching.

Addison-Wesley, Boston, second edition, 1998.

Reinhard Kutzelnigg. Analyse von Hash-Algorithmen. Master’s thesis, TU-Wien, 2005.

Reinhard Kutzelnigg. Bipartite random graphs and cuckoo hashing. In Proceedings of the 4th Colloquium on Mathematics and Computer Science, Discrete Mathematics and Theoretical Computer Science, pages 403–406, 2006.

Reinhard Kutzelnigg. An improved version of cuckoo hashing: Average case analysis of construction cost and search operations. In Proceedings of the 19th internatinal workshop on combinatorial algoritms, pages 253–266, 2008.

Bibliography

Chuck Lever. Linux kernel hash table behavior: Analysis and improvements. In Proceed-ings of the 4th Annual Linux Showcase and Conference, pages 13–26, 2000.

M. Lo´eve. Probability Theory 1. Springer, New York, fourth edition, 1977.

Tomasz Luczak. Random trees and random graphs. Random Structures and Algorithms, 13(3-4):485–500, 1998.

Wenbin Luo and Gregory L. Heileman. Improved exponential hashing. IEICE Electronic Express, 1(7):150–155, 2004.

G. Marsaglia. The marsaglia random number cdrom including the diehard battery of tests of randomness. http://stat.fsu.edu/pub/diehard/.

Makoto Matsumoto and Takuji Nishimura. Mersenne twister: a 623-dimensionally equidistributed uniform pseudo-random number generator. ACM Trans. Model. Com-put. Simul., 8(1):3–30, 1998. ISSN 1049-3301. doi: http://doi.acm.org/10.1145/272991.

272995.

A. Meir and J. W. Moon. On the altitude of nodes in random trees. Canadian Journal of Mathematics, 30:997–1015, 1978.

J. Ian Munro and Pedro Celis. Techniques for collision resolution in hash tables with open addressing. InProceedings of the Fall Joint Computer Conference, pages 601–610. IEEE Computer Society, 1986. ISBN 0-8186-0743-2.

Moni Naor, Gil Segev, and Udi Wieder. History-independent cuckoo hashing. InICALP 2008, Reykjavik, Iceland, July 7-11, 2008, Proceedings, volume 5126 of LNCS, pages 631–642. Springer, 2008. ISBN 978-3-540-70582-6.

Anna Pagh, Rasmus Pagh, and Milan Ruzic. Linear probing with constant independence.

In STOC ’07, pages 318–327, New York, NY, USA, 2007. ACM. ISBN 978-1-59593-631-8. doi: http://doi.acm.org/10.1145/1250790.1250839.

Rasmus Pagh and Flemming Friche Rodler. Cuckoo hashing. Research Series RS-01-32, BRICS, Department of Computer Science, University of Aarhus, 2001a.

Rasmus Pagh and Flemming Friche Rodler. Cuckoo hashing. In Algorithms - ESA 2001, 9th Annual European Symposium, volume 2161 of LNCS, pages 121–133. Springer, 2001b.

Rasmus Pagh and Flemming Friche Rodler. Cuckoo hashing. Journal of Algorithms, 51 (2):122–144, 2004.

Athanasios Papoulis and S. Unnikrishna Pillai. Probability, Random Variables and Stochastic Processes. McGraw-Hill, Boston, fourth edition, 2002.

A. P. Prudnikov, Yu. A. Brychkov, and O. I. Marichev. Integrals and Series, Volume 3:

More Special Functions. Gordon and Breach, New York and London, 1989.

William Pugh. Skip lists: a probabilistic alternative to balanced trees. Communications of the ACM, 33(6):668–676, 1990. ISSN 0001-0782.

Bibliography

M. V. Ramakrishna and Justin Zobel. Performance in practice of string hashing functions.

In DASFAA, Advanced Database Research and Development Series, pages 215–224.

World Scientific, 1997.

John Riordan. Combinatorial Identities. Wiley, New York, 1968.

John Riordan and N. J. A. Sloane. The enumeration of rooted trees by total height. J.

Australian Math. Soc., 10:278–282, 1969.

Kenneth A. Ross. Efficient hash probes on modern processors. IBM Research Report RC24100, IBM, 2006.

H. I. Scoins. The number of trees with nodes of alternate parity. Proc. Cambridge Philos.

Soc., 58:12–16, 1962.

Alan Siegel. On universal classes of fast high performance hash functions, their time-space tradeoff, and their applications (extended abstract). In FOCS, pages 20–25.

IEEE, 1989.

Bradley J. Smith, Gregory L. Heileman, and Chaouki T. Abdallah. The exponential hash function. ACM Journal of Experimental Algorithms, 2:3, 1997.

B. Stroustrup. Die C++ Programmiersprache. Adisson-Wesley, M¨unchen, 2000.

Thinh Ngoc Tran and Surin Kittitornkun. Fpga-based cuckoo hashing for pattern match-ing in nids/nips. InAPNOMS, pages 334–343, 2007.

Berthold V¨ocking. How asymmetry helps load balancing. J. ACM, 50(4):568–589, 2003.

Herbert S. Wilf. generatingfunctionology. Acad. Press, San Diego, Calif., second edition, 1999.

Semyom B. Yakubovich. Integral transformations by the index of lommel’s function.

Periodica Mathematica Hungarica, 46(2):223– 233, 2003.

Marcin Zukowski, S´andor H´eman, and Peter A. Boncz. Architecture-conscious hashing.

InDaMoN Proceedings of the 2nd international workshop on Data management on new hardware. ACM Press, 2006.

Daniel Zwillinger. Handbook of differential equations. Academic Press, Boston, second edition, 1992.

Table of Symbols and Notations

Symbol Interpretation

z real part of the complex number z z imaginary part of the complex number z P(A) probability of an eventA

P(A|B) probability of an eventA, conditioned on the occurrence of eventB Eη expectation of a random variable η

Vη variance of a random variable η

δi,j Kronecker’s delta,δi,j =

1 ifiequals j 0 otherwise x floor ofx, greatest integerksatisfying k≤x {x} fractional part ofx (i.e. x− x)

bitwise exclusive or operation xk x(x+ 1)(x+ 2). . .(x+k−1) xk x(x−1)(x2). . .(x−k+ 1) f(n) =O(g(n)) limn→∞ f(n)g(n) = 0

f(n) =O(g(n)) |f(n)| ≤c|g(n)|holds for all suff. largenand a constant c >0 f(n) = Θ(g(n)) c1|g(n)| ≤ |f(n)| ≤c2|g(n)|for suff. largenand const. c1, c2 >0 f(n) = Ω(g(n)) |f(n)| ≥c|g(n)|holds for all suff. largenand a constant c >0

x bold font indicates vectors, x= (x1, . . . , xd) xk multipower,xk=xk11. . . xkdd

[xn]a(x) n-th coefficient of the seriesa(x) =

n0anxn t(x) generating function of rooted labelled trees t(x)˜ generating function of unrooted labelled trees t(x, y) generating function of rooted labelled bipartite trees t(x, y)˜ generating function of unrooted labelled bipartite trees

List of Figures

1.1 An associative array implemented by a hash table. . . 2

1.2 Collision resolution by open addressing. . . 5

1.3 Collision resolution by chaining. . . 6

1.4 An evolving cuckoo hash table. . . 9

1.5 Insertion procedure in case of a tree component. . . 10

1.6 Insertion procedure in case of a unicyclic component. . . 11

3.1 The modulus of the function ez/z3 close to the origin. . . 22

4.1 Asymptotic expansion of the failure probability . . . 47

5.1 The modulus of f eζσ, e1 eζσe1 in the relevant area. . . 54

7.1 Bounds for the expected number of steps per insertion. . . 89

7.2 Bounds for the insertion using asymmetric cuckoo hashing. . . 95

8.1 Additional search costs in simplified cuckoo hashing. . . 101

8.2 Comparison of successful search . . . 105

8.3 Comparison of unsuccessful search . . . 105

A.1 Hierarchy of the C++ classes. . . 112

List of Tables

0.1 Overview of results concerning cuckoo hashing. . . viii

1.1 Asymptotic approximations of the cost of search operations. . . 6

2.1 “Dictionary” of constructions of unlabelled combinatorial configurations. . 17

2.2 “Dictionary” of constructions of labelled combinatorial configurations. . . 17

4.1 Number of failures . . . 48

5.1 Number of failures, critical case . . . 59

5.2 Average number of edges at the occurrence of the first bicycle. . . 59

6.1 Number of trees of sizes one, two, and five for ε= 0.4. . . 79

6.2 Number of trees of sizes one, two, and five for ε= 0.2. . . 80

6.3 Number of trees of sizes one, two, and five for ε= 0.1. . . 81

6.4 Number of trees of sizes one, two, and five for ε= 0.06. . . 82

6.5 Number of trees of sizes one, two, and five for ε= 0.04. . . 83

6.6 Number of cycles and number of nodes contained in cyclic components. . 84

7.1 Construction cost . . . 96

7.2 Average maximum number of steps of an insertion . . . 97

7.3 Maximum number of steps of an insertion . . . 98

8.1 Successful search . . . 106

A.1 Classes of the hash library. . . 112

List of Listings

7.1 Optimal insertion for cuckoo hashing. . . 93

8.1 Optimal search for cuckoo hashing. . . 100

9.1 Dynamic disjoint-set data structure. . . 108

A.1 base.hpp . . . 113

A.2 cuckoo.hpp . . . 114

A.3 cuckoo.cpp . . . 116

A.4 cuckoo main.cpp . . . 122

A.5 d-cuckoo.hpp . . . 127

A.6 d-cuckoo.cpp . . . 129

A.7 tables.hpp . . . 134

A.8 tables.cpp . . . 135

B.1 asym main one.mw . . . 139

B.2 asym main.mw . . . 142

B.3 asym main asymmetric.mw . . . 146

Lebenslauf

Ich wurde am 18. Mai 1980, als Sohn von Rosemarie Kutzelnigg, geborene Otter, und Alfred Kutzelnigg, in Vorau geboren. Von 1986 bis 1990 besuchte ich die Volksschule in Vorau, und von 1990 bis 1994 die Hauptschule, ebenfalls in meinem Geburtsort. An-schließend besuchte ich von 1994 bis 1999 die h¨ohere technische Bundeslehranstalt f¨ur Elektrotechnik in Pinkafeld, mit Schwerpunkt Steuerungs- und Regelungstechnik. Dort legte ich am 16. Juni 1999 die Reifepr¨ufung mit ausgezeichneten Erfolg ab. In den dar-auf folgenden Monaten leiste ich den Pr¨asenzdienst beim ¨osterreichischen Bundesheer in Pinkafeld ab.

Im September 2000 immatrikulierte ich an der Technischen Universit¨at Wien und be-gann mit dem Studium der Technischen Mathematik, Studienrichtung Mathematische Computerwissenschaften. Dieses schloss ich mit der Ablegung der zweiten Diplompr¨ufung am 23. November 2005 mit ausgezeichnetem Erfolg ab. W¨ahrend des Studiums war ich im Sommersemester 2003 f¨ur das Institut f¨ur Computergraphik und Algorithmen, und ab dem darauf folgenden Wintersemester f¨ur das Institut f¨ur Analysis und Scientific Com-puting, als Tutor t¨atig.

Im M¨arz 2006 inskribierte ich das Doktoratsstudium der technischen Wissenschaften.

Gleichzeitig nahm ich ein Anstellung als Projektassistent im von Prof. Michael Drmota geleiteten FWF-Projekt S9604

”Analytic and Probabilistic Methods in Combinatorics“

an, welches dem nationalen Forschungsnetzwerk

”Analytic Combinatorics and Probabi-listic Number Theory“ zugeh¨ort. Nach einem schweren Sportunfall im M¨arz 2008 und mehrmonatigen Krankenstand, wechselte ich im Juli 2008 zum Forschungsprojekt

” Net-work Models, Governance and R&D collaboration netNet-works“, Projekt Nummer 028875 des EU FP6-NEST-Adventure Programms. F¨ur dieses, an der TU Wien ebenfalls von Prof. Michael Drmota geleitete Projekt, bin ich derzeit als Projektassistent t¨atig.