s 1 if xπy and f(x) = f(y)

Size: px
Start display at page:

Download "s 1 if xπy and f(x) = f(y)"

Transcription

1 Algorithms Proessor John Rei Hash Function : A B ALG 4.2 Universal Hash Functions: CLR - Chapter 34 Auxillary Reading Selections: AHU-Data Section 4.7 BB Section Handout: Carter & Wegman, "Universal Classes o Hash Functions", JCSS, Vol. 8, pp , 979. keys indices has conlict at x,y e A i xπy but (x = (y { s i xπy and (x = (y (x,y = 0 else 2

2 I H is a set o hash unctions, s H (x,y = Â s (x,y e H or set o keys S, s H (x,s = Â e H Â y e S s (x,y a Keys a ŒH ( a b ( a b - Total Conlicts b Indices b a b a b keys / index conlicts / index [( ( a b - ] a 2 b - a 3 4

3 H is a universal 2 set o hash unctions i s H (x,y H B or all x,y e A i.e. no pair o keys x,y are mapped into the same index by > B o all unctions in H Proposition Given any set H o hash n, $ x,y e A s.t. ( s H (x,y > H - B A proo let a = A, b = B By counting, we can show x (x = (y A B y Conlict ( - ( AA b - a a a s, b 2 2 b 5 6

4 Thus sh (A,A a 2 H ( b - a By the pidgeon hole principle $ x,y e A s.t s H (x,y > H ( b - a note in most applications, A >> B and then any universal 2 class, has asymptotically a minimum number o conlicts Proposition 2: Let x A, S c A For chosen randomly rom a universal 2 class H o hash unctions, the expected number o colisions is proo E( s (x,s = H = H Â y e S H Â S = B y e S S s (x,s B Â e H s (x,s s H (x,y by deinition H B ' by deinition o universal 2 7 8

5 application associative memory storage o S keys onto B linked lists. Given key x e A, store x in list (x Proposition 2 implies each list has expected S length B = 0( i B S Gives 0( time or STORE, RETRIEVE, and DELETE operations Proposition 3 Let R be a sequence o requests with k insertion operations into an associative memory. I is chosen at random rom set o universal 2 class H, the expected total cost o all k searches is R ( + k B. proo There are R total search ops, and each takes by Proposition 2 expected k time +. B 9 note i B k, then expected total time is O( R. 0

6 Bounds on distribution o s (x,s Proposition 4 Let x ΠA, S A Let m = expected value o s (x,s For chosen randomly rom universal 2 set o unctions H, Prob (s (x,s > t. m < t H = universal set o hash unctions. 2 E = Expected cost o random set o k requests using a worst case unction in H (random input proo immediate rom Markov bound improved prob t 4 bounds on probability: or universal hash ns. H2, H 3 (using 2nd and 4th moments o prob. distribution. E = Expected cost o worst case set o k requests 2 using a random unction in H (randomized algorithm 2

7 P rop 5 E ( - e E 2 where e = B A Example o Universal 2 Class proo Let a = A, b = B. S Prop 2 implies E 2 + b Suppose S is chosen randomly. or x, y e S, E( s (x,y = a 2 s (A,A Set o Keys Table Let A = {0,,..., a-} Set o Keys B = {0,,..., b-} Table Let p be a prime a Zp = {0,,..., p-} = number ield mod p deine g : Z p Æ B s.t. g(x = x mod b deine or n,m e Z p with m π o, a 2 a 2 ( b - a by Prop h n, m : A Æ Z p with h n, m (x = (mx+n mod p deine n, m : A Æ B s.t. n, m (x = g(h m, n (x ( b - a H = { m,n m,n e Z p, mπo} So E + E (s (x,s Claim: H is universal 2 + S ( b - a 3 4

8 proo Lemma or distinct x, y ea, s H (x,y = s g (Z p, Z p s g (Z p, Z p = {(r,s r,s e Z p, r π s, g(r = g(s} Observe that the linear equations: xm + n = r (mod p ym + n = s (mod p have unique solutions in Z p So (r,s = (h m, n (x, h m, n (y then ( m, n (x = m, n (y i and only i g(r = g(s s H (x,y is the number o such pairs in (r,s e s g (Z p, Z p Theorem proo H is universal 2 Let n i = {t e Z p g(t = i} By deinition o g(x = x mod b, p- i n i + b For any given r, the number o s where s π r and g(r = g(s is s (r, Z p g p-. b But there are p choices o r, (p- so p ( b s (Z p, Z p g = s H (x,y by Lemma (Also note s (x,x = 0 H H Hence s H (x,y b since H = p(p- so H is universal 2 5 6

9 Universal Hash Fns on Long keys Given class o hash unctions H, deine hash unctions J = {h,g,g Œ H } where h,g (x, x 2 = (x g(x 2 exclusive or { 0 } Theorem Suppose B =,,, b = power o 2. Suppose this class o ns A $ real r" ieb" x, y ea, x π y K where b is a Æ B i { ( ( = } H e x y i rh Then " xy, Œ ( A A, x π y hj e hx ( hy ( = i rh { } Proo or x x, x, y y, y in A A = ( 2 = ( 2 { } ib e then hj e hx ( hy ( = i { g H x g x y g y i} =, ( ( ( ( = e 2 2 { }  H x y i gx gy = e ( ( = ( ( yh e 2 2 { Œ ( ( = } H x y i rh 7 example H with m = 0 gives J with r = universal! B 8

10 Universal 2 Hashing with out Multiplication A = set o d digit numbers base a so, A = a d B = set o binary numbers length j M = arrays o length d. a, with elements in B "m e M let m(k = kth element o array m "x e A let x k = kth digit o x base a d deinition m (x = m(x + m(x +x m( Â x k k= +k array m m( m(k Theorem H 2 = { m m e M } is universal 2 proo or x, y e A, let m (x = r r 2... r s rows o m m (y = r s+... r t Then m (x = m (y i r... r t = o But i xπy i $ k s. t. r k in only one o m (x, m (y so ( (x = (y m m i r k = r i i π k But there are only B possibilities or row r k so x,y will collide or o ns m e H B 2 Hence H 2 is universal

11 Analysis o Hashing or Uniorm Random Hash n Hashing with Chaining keep list o conlicts at each index load actor a = # o keys hashed # o indicies in Hash Table Conlicts... length is binomial variable expected length = a 2 Expected Time Cost per hash = O( + a By Cherno Bounds, with high likelyhood time cost per hash O( alog (# keys 22

12 Open Address Hashing (With Uniorm Random Hash n Resolve conlicts by applying another hash unction a = load actor = prob. o occupied hash address # rehashes as geometric variable expected hash time = - a = 2 + a + a + K 23

Lecture: Analysis of Algorithms (CS )

Lecture: Analysis of Algorithms (CS ) Lecture: Analysis of Algorithms (CS483-001) Amarda Shehu Spring 2017 1 Outline of Today s Class 2 Choosing Hash Functions Universal Universality Theorem Constructing a Set of Universal Hash Functions Perfect

More information

Hash Tables. Given a set of possible keys U, such that U = u and a table of m entries, a Hash function h is a

Hash Tables. Given a set of possible keys U, such that U = u and a table of m entries, a Hash function h is a Hash Tables Given a set of possible keys U, such that U = u and a table of m entries, a Hash function h is a mapping from U to M = {1,..., m}. A collision occurs when two hashed elements have h(x) =h(y).

More information

CS 591, Lecture 6 Data Analytics: Theory and Applications Boston University

CS 591, Lecture 6 Data Analytics: Theory and Applications Boston University CS 591, Lecture 6 Data Analytics: Theory and Applications Boston University Babis Tsourakakis February 8th, 2017 Universal hash family Notation: Universe U = {0,..., u 1}, index space M = {0,..., m 1},

More information

Hashing. Dictionaries Chained Hashing Universal Hashing Static Dictionaries and Perfect Hashing. Philip Bille

Hashing. Dictionaries Chained Hashing Universal Hashing Static Dictionaries and Perfect Hashing. Philip Bille Hashing Dictionaries Chained Hashing Universal Hashing Static Dictionaries and Perfect Hashing Philip Bille Hashing Dictionaries Chained Hashing Universal Hashing Static Dictionaries and Perfect Hashing

More information

Hashing. Hashing. Dictionaries. Dictionaries. Dictionaries Chained Hashing Universal Hashing Static Dictionaries and Perfect Hashing

Hashing. Hashing. Dictionaries. Dictionaries. Dictionaries Chained Hashing Universal Hashing Static Dictionaries and Perfect Hashing Philip Bille Dictionaries Dictionary problem. Maintain a set S U = {,..., u-} supporting lookup(x): return true if x S and false otherwise. insert(x): set S = S {x} delete(x): set S = S - {x} Dictionaries

More information

1 Maintaining a Dictionary

1 Maintaining a Dictionary 15-451/651: Design & Analysis of Algorithms February 1, 2016 Lecture #7: Hashing last changed: January 29, 2016 Hashing is a great practical tool, with an interesting and subtle theory too. In addition

More information

Hash tables. Hash tables

Hash tables. Hash tables Dictionary Definition A dictionary is a data-structure that stores a set of elements where each element has a unique key, and supports the following operations: Search(S, k) Return the element whose key

More information

Lecture 5: Hashing. David Woodruff Carnegie Mellon University

Lecture 5: Hashing. David Woodruff Carnegie Mellon University Lecture 5: Hashing David Woodruff Carnegie Mellon University Hashing Universal hashing Perfect hashing Maintaining a Dictionary Let U be a universe of keys U could be all strings of ASCII characters of

More information

ALG 4.3. Hashing Polynomials and Algebraic Expressions: Main Goal of Lecture: Algorithms Professor John Reif

ALG 4.3. Hashing Polynomials and Algebraic Expressions: Main Goal of Lecture: Algorithms Professor John Reif Algorithms Professor John Reif ALG 4.3 Hashing Polynomials and Algebraic Expressions: (a) Identity Testing of Polynomials (b) Applications of Polynomial Hashing (c) Hashing Classes of Algebraic Expressions

More information

Hash tables. Hash tables

Hash tables. Hash tables Dictionary Definition A dictionary is a data-structure that stores a set of elements where each element has a unique key, and supports the following operations: Search(S, k) Return the element whose key

More information

CS 473: Algorithms. Ruta Mehta. Spring University of Illinois, Urbana-Champaign. Ruta (UIUC) CS473 1 Spring / 32

CS 473: Algorithms. Ruta Mehta. Spring University of Illinois, Urbana-Champaign. Ruta (UIUC) CS473 1 Spring / 32 CS 473: Algorithms Ruta Mehta University of Illinois, Urbana-Champaign Spring 2018 Ruta (UIUC) CS473 1 Spring 2018 1 / 32 CS 473: Algorithms, Spring 2018 Universal Hashing Lecture 10 Feb 15, 2018 Most

More information

Analysis of Algorithms I: Perfect Hashing

Analysis of Algorithms I: Perfect Hashing Analysis of Algorithms I: Perfect Hashing Xi Chen Columbia University Goal: Let U = {0, 1,..., p 1} be a huge universe set. Given a static subset V U of n keys (here static means we will never change the

More information

ALG 4.1 Randomized Pattern Matching:

ALG 4.1 Randomized Pattern Matching: Algorithms Professor John Reif Generalized Pattern Matching ALG 4.1 Randomized Pattern Matching: Reading Selection: CLR: Chapter 12 Handout: R. Karp and M. Rabin, "Efficient Randomized Pattern-Matching"

More information

So far we have implemented the search for a key by carefully choosing split-elements.

So far we have implemented the search for a key by carefully choosing split-elements. 7.7 Hashing Dictionary: S. insert(x): Insert an element x. S. delete(x): Delete the element pointed to by x. S. search(k): Return a pointer to an element e with key[e] = k in S if it exists; otherwise

More information

Hash tables. Hash tables

Hash tables. Hash tables Basic Probability Theory Two events A, B are independent if Conditional probability: Pr[A B] = Pr[A] Pr[B] Pr[A B] = Pr[A B] Pr[B] The expectation of a (discrete) random variable X is E[X ] = k k Pr[X

More information

Hashing. Data organization in main memory or disk

Hashing. Data organization in main memory or disk Hashing Data organization in main memory or disk sequential, binary trees, The location of a key depends on other keys => unnecessary key comparisons to find a key Question: find key with a single comparison

More information

Algorithms lecture notes 1. Hashing, and Universal Hash functions

Algorithms lecture notes 1. Hashing, and Universal Hash functions Algorithms lecture notes 1 Hashing, and Universal Hash functions Algorithms lecture notes 2 Can we maintain a dictionary with O(1) per operation? Not in the deterministic sense. But in expectation, yes.

More information

Advanced Implementations of Tables: Balanced Search Trees and Hashing

Advanced Implementations of Tables: Balanced Search Trees and Hashing Advanced Implementations of Tables: Balanced Search Trees and Hashing Balanced Search Trees Binary search tree operations such as insert, delete, retrieve, etc. depend on the length of the path to the

More information

Data Structure. Mohsen Arab. January 13, Yazd University. Mohsen Arab (Yazd University ) Data Structure January 13, / 86

Data Structure. Mohsen Arab. January 13, Yazd University. Mohsen Arab (Yazd University ) Data Structure January 13, / 86 Data Structure Mohsen Arab Yazd University January 13, 2015 Mohsen Arab (Yazd University ) Data Structure January 13, 2015 1 / 86 Table of Content Binary Search Tree Treaps Skip Lists Hash Tables Mohsen

More information

Problem Set 4 Solutions

Problem Set 4 Solutions Introduction to Algorithms October 8, 2001 Massachusetts Institute of Technology 6.046J/18.410J Singapore-MIT Alliance SMA5503 Professors Erik Demaine, Lee Wee Sun, and Charles E. Leiserson Handout 18

More information

Introduction to Hash Tables

Introduction to Hash Tables Introduction to Hash Tables Hash Functions A hash table represents a simple but efficient way of storing, finding, and removing elements. In general, a hash table is represented by an array of cells. In

More information

A Lecture on Hashing. Aram-Alexandre Pooladian, Alexander Iannantuono March 22, Hashing. Direct Addressing. Operations - Simple

A Lecture on Hashing. Aram-Alexandre Pooladian, Alexander Iannantuono March 22, Hashing. Direct Addressing. Operations - Simple A Lecture on Hashing Aram-Alexandre Pooladian, Alexander Iannantuono March 22, 217 This is the scribing of a lecture given by Luc Devroye on the 17th of March 217 for Honours Algorithms and Data Structures

More information

Cache-Oblivious Hashing

Cache-Oblivious Hashing Cache-Oblivious Hashing Zhewei Wei Hong Kong University of Science & Technology Joint work with Rasmus Pagh, Ke Yi and Qin Zhang Dictionary Problem Store a subset S of the Universe U. Lookup: Does x belong

More information

? 11.5 Perfect hashing. Exercises

? 11.5 Perfect hashing. Exercises 11.5 Perfect hashing 77 Exercises 11.4-1 Consider inserting the keys 10; ; 31; 4; 15; 8; 17; 88; 59 into a hash table of length m 11 using open addressing with the auxiliary hash function h 0.k/ k. Illustrate

More information

compare to comparison and pointer based sorting, binary trees

compare to comparison and pointer based sorting, binary trees Admin Hashing Dictionaries Model Operations. makeset, insert, delete, find keys are integers in M = {1,..., m} (so assume machine word size, or unit time, is log m) can store in array of size M using power:

More information

Collision. Kuan-Yu Chen ( 陳冠宇 ) TR-212, NTUST

Collision. Kuan-Yu Chen ( 陳冠宇 ) TR-212, NTUST Collision Kuan-Yu Chen ( 陳冠宇 ) 2018/12/17 @ TR-212, NTUST Review Hash table is a data structure in which keys are mapped to array positions by a hash function When two or more keys map to the same memory

More information

Finger Search in the Implicit Model

Finger Search in the Implicit Model Finger Search in the Implicit Model Gerth Stølting Brodal, Jesper Sindahl Nielsen, Jakob Truelsen MADALGO, Department o Computer Science, Aarhus University, Denmark. {gerth,jasn,jakobt}@madalgo.au.dk Abstract.

More information

INTRODUCTION TO HASHING Dr. Thomas Hicks Trinity University. Data Set - SSN's from UTSA Class

INTRODUCTION TO HASHING Dr. Thomas Hicks Trinity University. Data Set - SSN's from UTSA Class Dr. Thomas E. Hicks Data Abstractions Homework - Hashing -1 - INTRODUCTION TO HASHING Dr. Thomas Hicks Trinity University Data Set - SSN's from UTSA Class 467 13 3881 498 66 2055 450 27 3804 456 49 5261

More information

Cuckoo Hashing with a Stash: Alternative Analysis, Simple Hash Functions

Cuckoo Hashing with a Stash: Alternative Analysis, Simple Hash Functions 1 / 29 Cuckoo Hashing with a Stash: Alternative Analysis, Simple Hash Functions Martin Aumüller, Martin Dietzfelbinger Technische Universität Ilmenau 2 / 29 Cuckoo Hashing Maintain a dynamic dictionary

More information

12 Hash Tables Introduction Chaining. Lecture 12: Hash Tables [Fa 10]

12 Hash Tables Introduction Chaining. Lecture 12: Hash Tables [Fa 10] Calvin: There! I finished our secret code! Hobbes: Let s see. Calvin: I assigned each letter a totally random number, so the code will be hard to crack. For letter A, you write 3,004,572,688. B is 28,731,569½.

More information

Hash Tables. Direct-Address Tables Hash Functions Universal Hashing Chaining Open Addressing. CS 5633 Analysis of Algorithms Chapter 11: Slide 1

Hash Tables. Direct-Address Tables Hash Functions Universal Hashing Chaining Open Addressing. CS 5633 Analysis of Algorithms Chapter 11: Slide 1 Hash Tables Direct-Address Tables Hash Functions Universal Hashing Chaining Open Addressing CS 5633 Analysis of Algorithms Chapter 11: Slide 1 Direct-Address Tables 2 2 Let U = {0,...,m 1}, the set of

More information

6.1 Occupancy Problem

6.1 Occupancy Problem 15-859(M): Randomized Algorithms Lecturer: Anupam Gupta Topic: Occupancy Problems and Hashing Date: Sep 9 Scribe: Runting Shi 6.1 Occupancy Problem Bins and Balls Throw n balls into n bins at random. 1.

More information

CS483 Design and Analysis of Algorithms

CS483 Design and Analysis of Algorithms CS483 Design and Analysis of Algorithms Lectures 2-3 Algorithms with Numbers Instructor: Fei Li lifei@cs.gmu.edu with subject: CS483 Office hours: STII, Room 443, Friday 4:00pm - 6:00pm or by appointments

More information

CSCB63 Winter Week10 - Lecture 2 - Hashing. Anna Bretscher. March 21, / 30

CSCB63 Winter Week10 - Lecture 2 - Hashing. Anna Bretscher. March 21, / 30 CSCB63 Winter 2019 Week10 - Lecture 2 - Hashing Anna Bretscher March 21, 2019 1 / 30 Today Hashing Open Addressing Hash functions Universal Hashing 2 / 30 Open Addressing Open Addressing. Each entry in

More information

Hashing. Martin Babka. January 12, 2011

Hashing. Martin Babka. January 12, 2011 Hashing Martin Babka January 12, 2011 Hashing Hashing, Universal hashing, Perfect hashing Input data is uniformly distributed. A dynamic set is stored. Universal hashing Randomised algorithm uniform choice

More information

ALG 4.0 Number Theory Algorithms:

ALG 4.0 Number Theory Algorithms: Algorithms Professor John Reif ALG 4.0 Number Theory Algorithms: (a) GCD (b) Multiplicative Inverse (c) Fermat & Euler's Theorems (d) Public Key Cryptographic Systems (e) Primality Testing Greatest Common

More information

Motivation. Dictionaries. Direct Addressing. CSE 680 Prof. Roger Crawfis

Motivation. Dictionaries. Direct Addressing. CSE 680 Prof. Roger Crawfis Motivation Introduction to Algorithms Hash Tables CSE 680 Prof. Roger Crawfis Arrays provide an indirect way to access a set. Many times we need an association between two sets, or a set of keys and associated

More information

COMP251: Hashing. Jérôme Waldispühl School of Computer Science McGill University. Based on (Cormen et al., 2002)

COMP251: Hashing. Jérôme Waldispühl School of Computer Science McGill University. Based on (Cormen et al., 2002) COMP251: Hashing Jérôme Waldispühl School of Computer Science McGill University Based on (Cormen et al., 2002) Table S with n records x: Problem DefiniNon X Key[x] InformaNon or data associated with x

More information

Insert Sorted List Insert as the Last element (the First element?) Delete Chaining. 2 Slide courtesy of Dr. Sang-Eon Park

Insert Sorted List Insert as the Last element (the First element?) Delete Chaining. 2 Slide courtesy of Dr. Sang-Eon Park 1617 Preview Data Structure Review COSC COSC Data Structure Review Linked Lists Stacks Queues Linked Lists Singly Linked List Doubly Linked List Typical Functions s Hash Functions Collision Resolution

More information

z-axis SUBMITTED BY: Ms. Harjeet Kaur Associate Professor Department of Mathematics PGGCG 11, Chandigarh y-axis x-axis

z-axis SUBMITTED BY: Ms. Harjeet Kaur Associate Professor Department of Mathematics PGGCG 11, Chandigarh y-axis x-axis z-ais - - SUBMITTED BY: - -ais - - - - - - -ais Ms. Harjeet Kaur Associate Proessor Department o Mathematics PGGCG Chandigarh CONTENTS: Function o two variables: Deinition Domain Geometrical illustration

More information

Explicit and Efficient Hash Functions Suffice for Cuckoo Hashing with a Stash

Explicit and Efficient Hash Functions Suffice for Cuckoo Hashing with a Stash Explicit and Efficient Hash Functions Suffice for Cuckoo Hashing with a Stash Martin Aumu ller, Martin Dietzfelbinger, Philipp Woelfel? Technische Universita t Ilmenau,? University of Calgary ESA Ljubljana,

More information

Hashing. Hashing DESIGN & ANALYSIS OF ALGORITHM

Hashing. Hashing DESIGN & ANALYSIS OF ALGORITHM Hashing Hashing Start with an array that holds the hash table. Use a hash function to take a key and map it to some index in the array. If the desired record is in the location given by the index, then

More information

1 Probability Review. CS 124 Section #8 Hashing, Skip Lists 3/20/17. Expectation (weighted average): the expectation of a random quantity X is:

1 Probability Review. CS 124 Section #8 Hashing, Skip Lists 3/20/17. Expectation (weighted average): the expectation of a random quantity X is: CS 24 Section #8 Hashing, Skip Lists 3/20/7 Probability Review Expectation (weighted average): the expectation of a random quantity X is: x= x P (X = x) For each value x that X can take on, we look at

More information

Exercises with solutions (Set B)

Exercises with solutions (Set B) Exercises with solutions (Set B) 3. A fair coin is tossed an infinite number of times. Let Y n be a random variable, with n Z, that describes the outcome of the n-th coin toss. If the outcome of the n-th

More information

( x) f = where P and Q are polynomials.

( x) f = where P and Q are polynomials. 9.8 Graphing Rational Functions Lets begin with a deinition. Deinition: Rational Function A rational unction is a unction o the orm ( ) ( ) ( ) P where P and Q are polynomials. Q An eample o a simple rational

More information

Fundamental Algorithms

Fundamental Algorithms Chapter 5: Hash Tables, Winter 2018/19 1 Fundamental Algorithms Chapter 5: Hash Tables Jan Křetínský Winter 2018/19 Chapter 5: Hash Tables, Winter 2018/19 2 Generalised Search Problem Definition (Search

More information

Hashing, Hash Functions. Lecture 7

Hashing, Hash Functions. Lecture 7 Hashing, Hash Functions Lecture 7 Symbol-table problem Symbol table T holding n records: x record key[x] Other fields containing satellite data Operations on T: INSERT(T, x) DELETE(T, x) SEARCH(T, k) How

More information

Introduction to Hashtables

Introduction to Hashtables Introduction to HashTables Boise State University March 5th 2015 Hash Tables: What Problem Do They Solve What Problem Do They Solve? Why not use arrays for everything? 1 Arrays can be very wasteful: Example

More information

Module 1: Analyzing the Efficiency of Algorithms

Module 1: Analyzing the Efficiency of Algorithms Module 1: Analyzing the Efficiency of Algorithms Dr. Natarajan Meghanathan Professor of Computer Science Jackson State University Jackson, MS 39217 E-mail: natarajan.meghanathan@jsums.edu What is an Algorithm?

More information

Lecture Lecture 3 Tuesday Sep 09, 2014

Lecture Lecture 3 Tuesday Sep 09, 2014 CS 4: Advanced Algorithms Fall 04 Lecture Lecture 3 Tuesday Sep 09, 04 Prof. Jelani Nelson Scribe: Thibaut Horel Overview In the previous lecture we finished covering data structures for the predecessor

More information

Lecture 8 HASHING!!!!!

Lecture 8 HASHING!!!!! Lecture 8 HASHING!!!!! Announcements HW3 due Friday! HW4 posted Friday! Q: Where can I see examples of proofs? Lecture Notes CLRS HW Solutions Office hours: lines are long L Solutions: We will be (more)

More information

1 Hashing. 1.1 Perfect Hashing

1 Hashing. 1.1 Perfect Hashing 1 Hashing Hashing is covered by undergraduate courses like Algo I. However, there is much more to say on this topic. Here, we focus on two selected topics: perfect hashing and cockoo hashing. In general,

More information

NON-EXPANSIVE HASHING

NON-EXPANSIVE HASHING COMBINATOICA Bolyai Society Springer-Verlag COMBINATOICA 18 (1) (1998) 121 132 NON-EXPANSIVE HASHING NATHAN LINIAL* and OI SASSON eceived February 5, 1996 In a non-expansive hashing scheme, similar inputs

More information

Searching. Constant time access. Hash function. Use an array? Better hash function? Hash function 4/18/2013. Chapter 9

Searching. Constant time access. Hash function. Use an array? Better hash function? Hash function 4/18/2013. Chapter 9 Constant time access Searching Chapter 9 Linear search Θ(n) OK Binary search Θ(log n) Better Can we achieve Θ(1) search time? CPTR 318 1 2 Use an array? Use random access on a key such as a string? Hash

More information

Discrete Math I Exam II (2/9/12) Page 1

Discrete Math I Exam II (2/9/12) Page 1 Discrete Math I Exam II (/9/1) Page 1 Name: Instructions: Provide all steps necessary to solve the problem. Simplify your answer as much as possible. Additionally, clearly indicate the value or expression

More information

CSE 190, Great ideas in algorithms: Pairwise independent hash functions

CSE 190, Great ideas in algorithms: Pairwise independent hash functions CSE 190, Great ideas in algorithms: Pairwise independent hash functions 1 Hash functions The goal of hash functions is to map elements from a large domain to a small one. Typically, to obtain the required

More information

GF(2 m ) arithmetic: summary

GF(2 m ) arithmetic: summary GF(2 m ) arithmetic: summary EE 387, Notes 18, Handout #32 Addition/subtraction: bitwise XOR (m gates/ops) Multiplication: bit serial (shift and add) bit parallel (combinational) subfield representation

More information

ON THE ORDER OF APPROXIMATION OF FUNCTIONS BY THE BIDIMENSIONAL OPERATORS FAVARD-SZÁSZ-MIRAKYAN

ON THE ORDER OF APPROXIMATION OF FUNCTIONS BY THE BIDIMENSIONAL OPERATORS FAVARD-SZÁSZ-MIRAKYAN An. Şt. Univ. Ovidius Constanţa Vol. 112, 2003, 163 170 ON THE ORDER OF APPROXIMATION OF FUNCTIONS BY THE BIDIMENSIONAL OPERATORS FAVARD-SZÁSZ-MIRAKYAN Ioana Taşcu and Anca Buie Abstract We will present

More information

Basics of hashing: k-independence and applications

Basics of hashing: k-independence and applications Basics of hashing: k-independence and applications Rasmus Pagh Supported by: 1 Agenda Load balancing using hashing! - Analysis using bounded independence! Implementation of small independence! Case studies:!

More information

THE CAUCHY PROBLEM VIA THE METHOD OF CHARACTERISTICS

THE CAUCHY PROBLEM VIA THE METHOD OF CHARACTERISTICS THE CAUCHY PROBLEM VIA THE METHOD OF CHARACTERISTICS ARICK SHAO In this short note, we solve the Cauchy, or initial value, problem or general ully nonlinear irst-order PDE. Throughout, our PDE will be

More information

PUTNAM TRAINING NUMBER THEORY. Exercises 1. Show that the sum of two consecutive primes is never twice a prime.

PUTNAM TRAINING NUMBER THEORY. Exercises 1. Show that the sum of two consecutive primes is never twice a prime. PUTNAM TRAINING NUMBER THEORY (Last updated: December 11, 2017) Remark. This is a list of exercises on Number Theory. Miguel A. Lerma Exercises 1. Show that the sum of two consecutive primes is never twice

More information

A Faster Randomized Algorithm for Root Counting in Prime Power Rings

A Faster Randomized Algorithm for Root Counting in Prime Power Rings A Faster Randomized Algorithm or Root Counting in Prime Power Rings Leann Kopp and Natalie Randall July 17, 018 Abstract Let p be a prime and Z[x] a polynomial o degree d such that is not identically zero

More information

Definitions, Theorems and Exercises. Abstract Algebra Math 332. Ethan D. Bloch

Definitions, Theorems and Exercises. Abstract Algebra Math 332. Ethan D. Bloch Definitions, Theorems and Exercises Abstract Algebra Math 332 Ethan D. Bloch December 26, 2013 ii Contents 1 Binary Operations 3 1.1 Binary Operations............................... 4 1.2 Isomorphic Binary

More information

Hashing. Dictionaries Hashing with chaining Hash functions Linear Probing

Hashing. Dictionaries Hashing with chaining Hash functions Linear Probing Hashing Dictionaries Hashing with chaining Hash functions Linear Probing Hashing Dictionaries Hashing with chaining Hash functions Linear Probing Dictionaries Dictionary: Maintain a dynamic set S. Every

More information

BANDELET IMAGE APPROXIMATION AND COMPRESSION

BANDELET IMAGE APPROXIMATION AND COMPRESSION BANDELET IMAGE APPOXIMATION AND COMPESSION E. LE PENNEC AND S. MALLAT Abstract. Finding eicient geometric representations o images is a central issue to improve image compression and noise removal algorithms.

More information

Abstract Data Type (ADT) maintains a set of items, each with a key, subject to

Abstract Data Type (ADT) maintains a set of items, each with a key, subject to Lecture Overview Dictionaries and Python Motivation Hash functions Chaining Simple uniform hashing Good hash functions Readings CLRS Chapter,, 3 Dictionary Problem Abstract Data Type (ADT) maintains a

More information

Miskolc Mathematical Notes HU e-issn On bivariate Meyer-König and Zeller operators. Ali Olgun

Miskolc Mathematical Notes HU e-issn On bivariate Meyer-König and Zeller operators. Ali Olgun Misolc Mathematical Notes HU e-issn 787-43 Vol. 4 (03), No 3, pp. 0-030 OI: 0.854/MMN.03.53 On bivariate Meyer-König and Zeller operators Ali Olgun Misolc Mathematical Notes HU e-issn 787-43 Vol. 4 (03),

More information

Statistical Mechanics and Combinatorics : Lecture II

Statistical Mechanics and Combinatorics : Lecture II Statistical Mechanics and Combinatorics : Lecture II Kircho s matrix-tree theorem Deinition (Spanning tree) A subgraph T o a graph G(V, E) is a spanning tree i it is a tree that contains every vertex in

More information

1. Definition: Order Statistics of a sample.

1. Definition: Order Statistics of a sample. AMS570 Order Statistics 1. Deinition: Order Statistics o a sample. Let X1, X2,, be a random sample rom a population with p.d.. (x). Then, 2. p.d.. s or W.L.O.G.(W thout Loss o Ge er l ty), let s ssu e

More information

0 Sets and Induction. Sets

0 Sets and Induction. Sets 0 Sets and Induction Sets A set is an unordered collection of objects, called elements or members of the set. A set is said to contain its elements. We write a A to denote that a is an element of the set

More information

Lecture 2. Frequency problems

Lecture 2. Frequency problems 1 / 43 Lecture 2. Frequency problems Ricard Gavaldà MIRI Seminar on Data Streams, Spring 2015 Contents 2 / 43 1 Frequency problems in data streams 2 Approximating inner product 3 Computing frequency moments

More information

Ergodic Theorems. Samy Tindel. Purdue University. Probability Theory 2 - MA 539. Taken from Probability: Theory and examples by R.

Ergodic Theorems. Samy Tindel. Purdue University. Probability Theory 2 - MA 539. Taken from Probability: Theory and examples by R. Ergodic Theorems Samy Tindel Purdue University Probability Theory 2 - MA 539 Taken from Probability: Theory and examples by R. Durrett Samy T. Ergodic theorems Probability Theory 1 / 92 Outline 1 Definitions

More information

Algorithms for Data Science

Algorithms for Data Science Algorithms for Data Science CSOR W4246 Eleni Drinea Computer Science Department Columbia University Tuesday, December 1, 2015 Outline 1 Recap Balls and bins 2 On randomized algorithms 3 Saving space: hashing-based

More information

The Number of Fields Generated by the Square Root of Values of a Given Polynomial

The Number of Fields Generated by the Square Root of Values of a Given Polynomial Canad. Math. Bull. Vol. 46 (1), 2003 pp. 71 79 The Number o Fields Generated by the Square Root o Values o a Given Polynomial Pamela Cutter, Andrew Granville, and Thomas J. Tucker Abstract. The abc-conjecture

More information

Introduction to Algorithms March 10, 2010 Massachusetts Institute of Technology Spring 2010 Professors Piotr Indyk and David Karger Quiz 1

Introduction to Algorithms March 10, 2010 Massachusetts Institute of Technology Spring 2010 Professors Piotr Indyk and David Karger Quiz 1 Introduction to Algorithms March 10, 2010 Massachusetts Institute of Technology 6.006 Spring 2010 Professors Piotr Indyk and David Karger Quiz 1 Quiz 1 Do not open this quiz booklet until directed to do

More information

A CONTINUOUS AND NOWHERE DIFFERENTIABLE FUNCTION, FOR MATH 320

A CONTINUOUS AND NOWHERE DIFFERENTIABLE FUNCTION, FOR MATH 320 A CONTINUOUS AND NOWHERE DIFFERENTIABLE FUNCTION, FOR MATH 320 This note is a demonstration of some of the details in Abbott s construction of a nowhere differentiable continuous function. The discovery

More information

9.1. Unit 9. Implementing Combinational Functions with Karnaugh Maps or Memories

9.1. Unit 9. Implementing Combinational Functions with Karnaugh Maps or Memories . Unit Implementing Combinational Functions with Karnaugh Maps or Memories . Outcomes I can use Karnaugh maps to synthesize combinational functions with several outputs I can determine the appropriate

More information

Searching, mainly via Hash tables

Searching, mainly via Hash tables Data structures and algorithms Part 11 Searching, mainly via Hash tables Petr Felkel 26.1.2007 Topics Searching Hashing Hash function Resolving collisions Hashing with chaining Open addressing Linear Probing

More information

PMI Rational Expressions & Equations Unit

PMI Rational Expressions & Equations Unit PMI Rational Expressions & Equations Unit Variation Class Work 1. y varies inversely with x. If y = 1 when x =, find y when x = 6.. y varies inversely with x. If y = 8 when x =, find x wheny =.. y varies

More information

Symbol-table problem. Hashing. Direct-access table. Hash functions. CS Spring Symbol table T holding n records: record.

Symbol-table problem. Hashing. Direct-access table. Hash functions. CS Spring Symbol table T holding n records: record. CS 5633 -- Spring 25 Symbol-table problem Hashing Carola Wenk Slides courtesy of Charles Leiserson with small changes by Carola Wenk CS 5633 Analysis of Algorithms 1 Symbol table holding n records: record

More information

A General-Purpose Counting Filter: Making Every Bit Count. Prashant Pandey, Michael A. Bender, Rob Johnson, Rob Patro Stony Brook University, NY

A General-Purpose Counting Filter: Making Every Bit Count. Prashant Pandey, Michael A. Bender, Rob Johnson, Rob Patro Stony Brook University, NY A General-Purpose Counting Filter: Making Every Bit Count Prashant Pandey, Michael A. Bender, Rob Johnson, Rob Patro Stony Brook University, NY Approximate Membership Query (AMQ) insert(x) ismember(x)

More information

1 Relative degree and local normal forms

1 Relative degree and local normal forms THE ZERO DYNAMICS OF A NONLINEAR SYSTEM 1 Relative degree and local normal orms The purpose o this Section is to show how single-input single-output nonlinear systems can be locally given, by means o a

More information

LECTURE 3. Last time:

LECTURE 3. Last time: LECTURE 3 Last time: Mutual Information. Convexity and concavity Jensen s inequality Information Inequality Data processing theorem Fano s Inequality Lecture outline Stochastic processes, Entropy rate

More information

( ) Chapter 6 ( ) ( ) ( ) ( ) Exercise Set The greatest common factor is x + 3.

( ) Chapter 6 ( ) ( ) ( ) ( ) Exercise Set The greatest common factor is x + 3. Chapter 6 Exercise Set 6.1 1. A prime number is an integer greater than 1 that has exactly two factors, itself and 1. 3. To factor an expression means to write the expression as the product of factors.

More information

Secret Sharing CPT, Version 3

Secret Sharing CPT, Version 3 Secret Sharing CPT, 2006 Version 3 1 Introduction In all secure systems that use cryptography in practice, keys have to be protected by encryption under other keys when they are stored in a physically

More information

Sorting algorithms. Sorting algorithms

Sorting algorithms. Sorting algorithms Properties of sorting algorithms A sorting algorithm is Comparison based If it works by pairwise key comparisons. In place If only a constant number of elements of the input array are ever stored outside

More information

1 Difference between grad and undergrad algorithms

1 Difference between grad and undergrad algorithms princeton univ. F 4 cos 52: Advanced Algorithm Design Lecture : Course Intro and Hashing Lecturer: Sanjeev Arora Scribe:Sanjeev Algorithms are integral to computer science and every computer scientist

More information

GROUPS OF ORDER p 3 KEITH CONRAD

GROUPS OF ORDER p 3 KEITH CONRAD GROUPS OF ORDER p 3 KEITH CONRAD For any prime p, we want to describe the groups of order p 3 up to isomorphism. From the cyclic decomposition of finite abelian groups, there are three abelian groups of

More information

On the Girth of (3,L) Quasi-Cyclic LDPC Codes based on Complete Protographs

On the Girth of (3,L) Quasi-Cyclic LDPC Codes based on Complete Protographs On the Girth o (3,L) Quasi-Cyclic LDPC Codes based on Complete Protographs Sudarsan V S Ranganathan, Dariush Divsalar and Richard D Wesel Department o Electrical Engineering, University o Caliornia, Los

More information

14.1 Finding frequent elements in stream

14.1 Finding frequent elements in stream Chapter 14 Streaming Data Model 14.1 Finding frequent elements in stream A very useful statistics for many applications is to keep track of elements that occur more frequently. It can come in many flavours

More information

Problem 1: (Chernoff Bounds via Negative Dependence - from MU Ex 5.15)

Problem 1: (Chernoff Bounds via Negative Dependence - from MU Ex 5.15) Problem 1: Chernoff Bounds via Negative Dependence - from MU Ex 5.15) While deriving lower bounds on the load of the maximum loaded bin when n balls are thrown in n bins, we saw the use of negative dependence.

More information

Review of Prerequisite Skills for Unit # 2 (Derivatives) U2L2: Sec.2.1 The Derivative Function

Review of Prerequisite Skills for Unit # 2 (Derivatives) U2L2: Sec.2.1 The Derivative Function UL1: Review o Prerequisite Skills or Unit # (Derivatives) Working with the properties o exponents Simpliying radical expressions Finding the slopes o parallel and perpendicular lines Simpliying rational

More information

Randomized Algorithms. Zhou Jun

Randomized Algorithms. Zhou Jun Randomized Algorithms Zhou Jun 1 Content 13.1 Contention Resolution 13.2 Global Minimum Cut 13.3 *Random Variables and Expectation 13.4 Randomized Approximation Algorithm for MAX 3- SAT 13.6 Hashing 13.7

More information

arxiv: v1 [math.gt] 20 Feb 2008

arxiv: v1 [math.gt] 20 Feb 2008 EQUIVALENCE OF REAL MILNOR S FIBRATIONS FOR QUASI HOMOGENEOUS SINGULARITIES arxiv:0802.2746v1 [math.gt] 20 Feb 2008 ARAÚJO DOS SANTOS, R. Abstract. We are going to use the Euler s vector ields in order

More information

CSCI8980 Algorithmic Techniques for Big Data September 12, Lecture 2

CSCI8980 Algorithmic Techniques for Big Data September 12, Lecture 2 CSCI8980 Algorithmic Techniques for Big Data September, 03 Dr. Barna Saha Lecture Scribe: Matt Nohelty Overview We continue our discussion on data streaming models where streams of elements are coming

More information

Course 2BA1: Trinity 2006 Section 9: Introduction to Number Theory and Cryptography

Course 2BA1: Trinity 2006 Section 9: Introduction to Number Theory and Cryptography Course 2BA1: Trinity 2006 Section 9: Introduction to Number Theory and Cryptography David R. Wilkins Copyright c David R. Wilkins 2006 Contents 9 Introduction to Number Theory and Cryptography 1 9.1 Subgroups

More information

1 Categories, Functors, and Natural Transformations. Discrete categories. A category is discrete when every arrow is an identity.

1 Categories, Functors, and Natural Transformations. Discrete categories. A category is discrete when every arrow is an identity. MacLane: Categories or Working Mathematician 1 Categories, Functors, and Natural Transormations 1.1 Axioms or Categories 1.2 Categories Discrete categories. A category is discrete when every arrow is an

More information

Bounds on the OBDD-Size of Integer Multiplication via Universal Hashing

Bounds on the OBDD-Size of Integer Multiplication via Universal Hashing Bounds on the OBDD-Size of Integer Multiplication via Universal Hashing Philipp Woelfel Dept. of Computer Science University Dortmund D-44221 Dortmund Germany phone: +49 231 755-2120 fax: +49 231 755-2047

More information

Introduction to Algorithms

Introduction to Algorithms Introduction to Algorithms, Lecture 5 // Introduction to Algorithms 6.46J/.4J LECTURE Shortest Paths I Properties o shortest paths Dijkstra s Correctness Analysis Breadth-irst Pro. Manolis Kellis March,

More information

Lecture 12: Hash Tables [Sp 15]

Lecture 12: Hash Tables [Sp 15] Insanity is repeating the same mistaes and expecting different results. Narcotics Anonymous (1981) Calvin: There! I finished our secret code! Hobbes: Let s see. Calvin: I assigned each letter a totally

More information