CPSC 259 admin notes

Size: px
Start display at page:

Download "CPSC 259 admin notes"

Transcription

1 CPSC 9 admin notes! TAs Office hours next week! Monday during LA 9 - Pearl! Monday during LB Andrew! Monday during LF Marika! Monday during LE Angad! Tuesday during LH 9 Giorgio! Tuesday during LG - Pearl! Friday during LC 9 - Pearl! Friday during LD Lawrence! Online quizzes are due next Friday Nov 8 CPSC 9 Hashing Page

2 CPSC 9: Data Structures and Algorithms for Electrical Engineers Hashing Textbook Reference: Thareja first edition: Chapter, pages -7 Thareja second edition: Chapter, pages -88 Instructor: Dr. Hassan Khosravi September-December CPSC 9 Hashing Page

3 Learning Goals Provide examples of the types of problems that can benefit from a hash data structure. Compare and contrast open addressing and chaining. Evaluate collision resolution policies. Describe the conditions under which hashing can degenerate from O() expected complexity to O(n). Determine the characteristics of a good hash function (e.g., uniform distribution, fast to compute, appropriate table size). Determine how well a hashing solution scales. Explain how to solve scalability problems. CPSC 9 Hashing Page

4 weeks journey filled with data structures, complexity, and algorithms! We have learned! Pointers, struct, and dynamic memory allocation.! Computing the complexity of our algorithms! Linked lists, Stack and Queue! Recursion and applications! Binary trees and Binary search trees! Binary heaps and heapsorts! Sorting CPSC 9 Hashing Page

5 Hashing A data structure that allows O() search, insert and delete Biometrics and Identity Management Digital signatures CPSC 9 Public-Key Infrastructure Hashing Page

6 CPSC 9 Hashing Page

7 Hashing CPSC 9 Hashing Page 7

8 Introductory Examples! We have studied two search algorithms! Linear search has running time proportional to O(n)! Binary search takes time proportional to O(log n)! Can we do better?! Example (natural, numeric keys): In a small company of employees, each employee is assigned an Emp_ID number in the range 99. To store the employee s records in an array, each employee s Emp_ID number acts as an index into the array where this employee s record will be stored as shown in figure KEY ARRAY OF EMPLOYEE S RECORD Key [] Record of employee having Emp_ID Key [] Record of employee having Emp_ID.. Key 99 [99] Record of employee having Emp_ID 99 CPSC 9 Hashing Page 8

9 Introductory Examples! Let s assume that the same company uses a five digit Emp_ID number as the primary key. In this case, key values will range from to If we want to use the same technique as above, we will need an array of size,, of which only elements will be used. KEY ARRAY OF EMPLOYEE S RECORD Key [] Record of employee having Emp_ID. Key n [n] Record of employee having Emp_ID n.. Key [99999] Record of employee having Emp_ID 99999! It is impractical to waste that much storage just to ensure that each employee s record is in a unique and predictable location. CPSC 9 Hashing Page 9

10 Introductory Examples! Another possible option is to use just the last two digits of key to identify each employee.! Employee with Emp_ID number 799 is stored at index 9.! Employee with Emp_ID number is stored at index.! Would this be a good idea? Why? Why not? CPSC 9 Hashing Page

11 Example (characters): Suppose we want to design a frequency table for counting the number of times that each character appears in a file. We can use the character s ASCII code (8 bits = possibilities) as the key to index into an array of frequencies (the values): e.g., A = a = 97; = 8 97 In this example, our array of frequencies will have size : one for each of the different ASCII characters. It may well be that not all of these different characters are in a given file, and so we are potentially wasting memory. What we gain is the benefit of accessing frequencies in O() time. Is this a good time/space trade-off? Suppose we make the call: int freqa = getfrequency( A ); Since the ASCII code for A has the numeric value, freqa is set to the frequency found at array index. CPSC 9 Hashing Page

12 Example (long numeric keys): Suppose we want to keep track of Visa credit card accounts. Visa card numbers are long: digits allowing for a total of different numbers. If we were to build an array capable of holding accounts, we would have way more accounts than there are people on Earth! (We couldn t hold the entire table in memory, either.) It is not reasonable to use the Visa credit card number to index into an array. We ll see how to solve this problem momentarily. Example (strings): What if the key is a string? For example, social insurance numbers in the United Kingdom are alphanumeric. We cannot use a non-numeric string to index into an array. Solution: Convert String to int? Hashing solves these problems. How? We define a function that transforms keys into a numeric array index. Such a function is called a hash function. CPSC 9 Hashing Page

13 Hash function! Hash Function, h is simply a mathematical formula which when applied to the key, produces an integer which can be used as an index for the key in the hash table! The goal of a hash function is to produce a unique set of integers within some suitable range to disperse the keys in an apparently random, uniform way. Why? Avoid clusters (collisions) O() access! As much as we would like to produce unique keys, it is not always possible, so we might have two or more keys that map to the same memory location. This is called collision. CPSC 9 Hashing Page

14 Hash Table Terminology hash function Alan Steve Hassan Kendra Ed f(x) collision keys load factor λ = # of entries in table tablesize CPSC 9 Hashing Page

15 A Good Hash Function! Is easy (fast) to compute; O()! Distributes the data evenly (hash(a) hash(b), as much as possible).! Uses the whole hash table! (for all k < size, there s an i such that hash(i) % size = k). CPSC 9 Hashing Page

16 Strategies for Building Hash Functions Truncation: Use only part of the key as the hash index. For example, if we want to build a table of student records at UBC, then rather than using the entire student number (8 digits) as the key, we could use only the first digits. We would therefore require an array with space for up to student records. Note that some students may have the first digits of their student number in common, and so collisions would occur. Folding: Partition the key into parts and combine the parts using arithmetic operations. For example, we could take a Visa number and partition it into one digit number, plus two digit numbers. We could then add these three numbers together to come up with a hash index. CPSC 9 Hashing Page

17 Strategies for Building Hash Functions Modular Arithmetic: Use the modulus (remainder) operator (% in C) to produce a hash index in a given range. % = For example, suppose a company with employees wants to use each employee s Social Insurance Number as a key. We might use an array (hash table) of size, thereby leaving room for expansion. We can then generate a hash index from the Social Insurance Number as follows: hashindex = SIN % ; Again, we would expect this hash function to lead to collisions % = CPSC 9 Hashing Page 7

18 Alphanumeric Keys Suppose we have a table capable of holding records, and whose keys consist of strings that are characters long. We can apply numeric operations to the ASCII codes of the characters in the string in order to determine a hash index: int hash(char * key){! int hashcode = ;! int index = ;! while (key[index]!= \ ){! hashcode += (int)key[index];! index++;! }! return hashcode % ;! }! C A M E C O / C = 7 A = M = 77 E = 9 C = 7 O = 79 = CAMECO 999 CPSC 9 Hashing Page 8

19 Alphanumeric Keys What is a significant problem with this approach? Hash of any string with the same six letters is the same ASCII values have a max of * =, which means [ 999] are wasted A solution: hashcode = ;! while (key[index]!= \ ){! hashcode = *hashcode + key[index];! index++;! } ((((((7) + )+ 77)+9)+7) + 79) % 999= 89 CPSC 9 Hashing Page 9

20 Collisions If a hash function h maps two different keys x and y to the same index (i.e., x y and h(x) = h(y)), then x and y collide. A perfect hash function causes no collisions. Unfortunately, creating a perfect hash function requires knowledge of what keys will be hashed. Even a hash function that distributes items randomly (why is this not a practical hash function?) will cause collisions even when the number of items hashed is small. To see why, consider the birthday paradox from statistics: The probability of finding or more people that share the same birthday, in a room of n people, is > % if n. So, we must design a collision handling scheme. CPSC 9 Hashing Page

21 The Pigeonhole Principle (informal) You can t put k+ pigeons into k holes without putting two pigeons in the same hole. Image by en:user:mckay, used under CC attr/share-alike. This place just isn t coo anymore. Pigeonhole principle says we can t avoid all collisions try to hash without collision m keys into n slots with m > n try to put pigeons into holes CPSC 9 Hashing Page

22 Clicker question Suppose we have colours of Halloween candy, and that there s lots of candy in a bag. How many pieces of candy do we have to pull out of the bag if we want to be sure to get of the same colour? a. b. c. d. 8 e. None of these CPSC 9 Hashing Page

23 Clicker question (answer) Suppose we have colours of Halloween candy, and that there s lots of candy in a bag. How many pieces of candy do we have to pull out of the bag if we want to be sure to get of the same colour? a. b. c. d. 8 e. None of these CPSC 9 Hashing Page

24 Collision Resolution! Pigeonhole principle says we can t avoid all collisions! try to hash without collision m keys into n slots with m > n! try to put pigeons into holes! What do we do when two keys hash to the same entry?! chaining: put a linked list in each entry shove extra pigeons in one hole!! open addressing: pick a next entry to try CPSC 9 Hashing Page

25 Hashing Method #: Chaining Each table location points to a linked list (chain) of items that hash to this location. When we search for an item, we apply the hash function to get its hash index and then perform a linear search of the linked list. If the item is not in the list, then it s not in the table. Properties λ can be greater than performance degrades with length of chains a e c load factor λ = h(a) = h(d) h(e) = h(b) d b # of entries in table tablesize CPSC 9 Hashing Page

26 In-class exercise Example: Suppose h(x) = x/ mod Hash:, 88, 9,, 99, 9, Example: find node with key CPSC 9 Hashing Page

27 Deleting when using chaining Example: Suppose h(x) = x/ mod Hash:, 88,, 99, Delete Remove from the linked list CPSC 9 Hashing Page 7

28 Pros and cons of chaining Advantages of Chaining: The size s of the hash table can be smaller than the number of items n hashed. Why is this often a good thing? Fewer blank/wasted cells (especially in the case where the number of cells greatly exceeds the number of keys). Collision handling is easy: O(). Can accommodate overflows Disadvantages of Chaining: Search time can become O(n) due to long chains. Overhead of pointers: extra space, extra work. CPSC 9 Hashing Page 8

29 CPSC 9 admin notes! TAs Office hours for today! Friday during LC 9 - Pearl! Friday during LD Lawrence! My office hour! Monday -! Online quizzes are due tonight :9pm! Participation (clicker) grades are now available on Connect! %, Check your grade. I still have active clicker that has not been registered.! Final CPSC9 DEC, : PM OSBO A! Other than a calculator, no electronic equipment is allowed. You may not use your cell phone as a calculator. CPSC 9 Hashing Page 9

30 Hashing Method #: Open Addressing There is no linked list here. We have a hash table containing key-value pairs, and we handle collisions by trying a sequence of table entries until either the item is found in the table or we reach an empty cell. Properties λ performance degrades with difficulty of finding right spot h(a) = h(d) h(e) = h(b) a d e b c load factor λ = # of entries in table tablesize CPSC 9 Hashing Page

31 Probing Probing sequence is: h(k) mod size If h(k) is occupied, try (h(k) + f()) mod size If (h(k) + f()) mod size is occupied, try (h(k) + f()) mod size And so forth Probing properties the i th probe is to (h(k) + f(i)) mod size where f() = if i reaches size, the insert has failed depending on f(), the insert may fail sooner long sequences of probes are costly! CPSC 9 Hashing Page

32 Probe sequence is h(k) mod size (h(k) + ) mod size (h(k) + ) mod size Linear probing f(i) = i For any λ <, linear probing will find an empty slot CPSC 9 Hashing Page

33 In-class exercise Using the hash function h(x) = x % 7 insert the following values using linear probing: 7, 9,, 7,, insert(7) 7%7 = insert(9) 9%7 = insert() %7 = insert(7) 7%7 = insert() %7 = insert() %7 = probes: CPSC 9 Hashing Page

34 Problems with linear probing! The algorithm results in clustering! Where there has been one collision there will be more! Clusters of consecutive cells are formed and the time required for a search increases with the size of the cluster.! Also, when a new value has to be inserted in to the table at a position which is already occupied, that value is inserted at the end of the cluster, which all the more increases the length of the cluster.! This phenomenon is called primary clustering. To avoid primary clustering, other techniques like quadratic probing and double hashing are used. CPSC 9 Hashing Page

35 Quadratic Probing f(i) = i Probe sequence is h(k) mod size (h(k) + ) mod size (h(k) + ) mod size (h(k) + 9) mod size CPSC 9 Hashing Page

36 Quadratic Probing Example Using the hash function h(x) = x % 7 insert the following values using quadratic probing: 7,, 8,, insert(7) 7%7 = insert() %7 = insert(8) 8%7 = insert() %7 = insert() %7 = probes: CPSC 9 Hashing Page

37 Quadratic Probing Example L Using the hash function h(x) = x % 7 insert the following values using quadratic probing: 7, 9,,, 7 insert(7) 7%7 = insert(9) 9%7 = insert() %7 = insert() %7 = insert(7) 7%7 = probes: CPSC 9 Hashing Page 7

38 Example: h(x) = x mod Clicker question Hash these keys,,,, using quadratic probing. Which cell in the array does key hash to? A. B. C. D. 7 E CPSC 9 Hashing Page 8

39 Example: h(x) = x mod Clicker question (answer) Hash these keys,,,, using quadratic probing. Which cell in the array does key hash to? A. B. C. D. 7 E CPSC 9 Hashing Page 9

40 Problems with quadratic probing! Quadratic probing resolves to the primary clustering problem that exists in linear probing! One of the major drawbacks with quadratic probing is that a sequence of successive probes may only explore a fraction of the table, and this fraction may be quite small! we will not be able to find an empty location in the table despite the fact that the table is by no means full (See example from few pages ago).! This phenomenon is called secondary clustering: if there is a collision between two keys then the same probe sequence will be followed for both. CPSC 9 Hashing Page

41 Double Hashing f(i) = i hash (k) Probe sequence is h (k) mod size (h (k) + h (k)) mod size (h (k) + h (k)) mod size A good second hash function is quick to evaluate. differs from the original hash function. never evaluates to (mod size). CPSC 9 Hashing Page

42 Double Hashing Example Using the hash functions h (x) = x % 7 and h (x)= - (x % ) insert the following values using double hashing 7, 9,, 7,, insert(7) 7%7 = insert(9) 9%7 = insert() %7 = insert(7) insert() 7%7 = %7 = - (7%) = insert() %7 = - (%) = probes: CPSC 9 Hashing Page

43 Clicker question The primary hash function is: h (k) = (k + ) mod. The secondary hash function is: h (k) = 7 (k mod 7) Hash these keys, in this order:,,, 88,, 9,. Which cell in the array does key hash to? A. B. C. D. E CPSC 9 Hashing Page

44 Clicker question (answer) h (k) = (k + ) mod. h (k) = 7 (k mod 7),,, 88,, 9,. Which cell in the array does key hash to? h() = (() + ) % = 7 A. B. C. D. E. h() = (() + ) % = h() = (() + ) % = 9 h(88) = ((88) + ) % = +7 88%7 = 8 h() = (() + ) % = %7 = h(9) = ((9) + ) % = h() = (() + ) % = +( 7 %7) = CPSC 9 Hashing Page

45 Deleting when using probing Example: Suppose locations [97] to [] are occupied in our hash table: [] [] [97] [98] [99] [] [] [] dog cat goat owl deer Suppose a new key hashes to [97]. Assuming a linear collision resolution policy, the key goes to. Later, suppose we delete the key that was hashed to [98]. Add a tombstone (i.e., flag, marker) for reasons:. If searching, keep going when you hit a tombstone.. If inserting, stop and the add item here. This means that table entries can be occupied, deleted, or free CPSC 9 Hashing Page

46 Open Addressing summarized Advantage of Open Addressing No memory is wasted on pointers. Performance of Hashing Performance depends on: the quality of the hash function (includes N) the collision resolution algorithm the available space in the hash table To estimate how full a table is, we calculate the load factor α: α = ( # entries in table ) / ( table size ) For open addressing, α. For chaining, α <. CPSC 9 Hashing Page

47 Learning Goals revisited Provide examples of the types of problems that can benefit from a hash data structure. Compare and contrast open addressing and chaining. Evaluate collision resolution policies. Describe the conditions under which hashing can degenerate from O() expected complexity to O(n). Identify the types of search problems that do not benefit from hashing (e.g., range searching) and explain why. Determine the characteristics of a good hash function (e.g., uniform distribution, onto function, appropriate table size). Determine how well a hashing solution scales. Explain how to solve scalability problems. CPSC 9 Hashing Page 7

Unit #5: Hash Functions and the Pigeonhole Principle

Unit #5: Hash Functions and the Pigeonhole Principle Unit #5: Hash Functions and the Pigeonhole Principle CPSC 221: Basic Algorithms and Data Structures Jan Manuch 217S1: May June 217 Unit Outline Constant-Time Dictionaries? Hash Table Outline Hash Functions

More information

Hash Tables. Hash functions Open addressing. November 24, 2017 Hassan Khosravi / Geoffrey Tien 1

Hash Tables. Hash functions Open addressing. November 24, 2017 Hassan Khosravi / Geoffrey Tien 1 Hash Tables Hash functions Open addressing November 24, 2017 Hassan Khosravi / Geoffrey Tien 1 Review: hash table purpose We want to have rapid access to a dictionary entry based on a search key The key

More information

CMSC 341 Hashing (Continued) Based on slides from previous iterations of this course

CMSC 341 Hashing (Continued) Based on slides from previous iterations of this course CMSC 341 Hashing (Continued) Based on slides from previous iterations of this course Today s Topics Review Uses and motivations of hash tables Major concerns with hash tables Properties Hash function Hash

More information

5. Hashing. 5.1 General Idea. 5.2 Hash Function. 5.3 Separate Chaining. 5.4 Open Addressing. 5.5 Rehashing. 5.6 Extendible Hashing. 5.

5. Hashing. 5.1 General Idea. 5.2 Hash Function. 5.3 Separate Chaining. 5.4 Open Addressing. 5.5 Rehashing. 5.6 Extendible Hashing. 5. 5. Hashing 5.1 General Idea 5.2 Hash Function 5.3 Separate Chaining 5.4 Open Addressing 5.5 Rehashing 5.6 Extendible Hashing Malek Mouhoub, CS340 Fall 2004 1 5. Hashing Sequential access : O(n). Binary

More information

AAL 217: DATA STRUCTURES

AAL 217: DATA STRUCTURES Chapter # 4: Hashing AAL 217: DATA STRUCTURES The implementation of hash tables is frequently called hashing. Hashing is a technique used for performing insertions, deletions, and finds in constant average

More information

COMP171. Hashing.

COMP171. Hashing. COMP171 Hashing Hashing 2 Hashing Again, a (dynamic) set of elements in which we do search, insert, and delete Linear ones: lists, stacks, queues, Nonlinear ones: trees, graphs (relations between elements

More information

Open Addressing: Linear Probing (cont.)

Open Addressing: Linear Probing (cont.) Open Addressing: Linear Probing (cont.) Cons of Linear Probing () more complex insert, find, remove methods () primary clustering phenomenon items tend to cluster together in the bucket array, as clustering

More information

TABLES AND HASHING. Chapter 13

TABLES AND HASHING. Chapter 13 Data Structures Dr Ahmed Rafat Abas Computer Science Dept, Faculty of Computer and Information, Zagazig University arabas@zu.edu.eg http://www.arsaliem.faculty.zu.edu.eg/ TABLES AND HASHING Chapter 13

More information

CMSC 341 Lecture 16/17 Hashing, Parts 1 & 2

CMSC 341 Lecture 16/17 Hashing, Parts 1 & 2 CMSC 341 Lecture 16/17 Hashing, Parts 1 & 2 Prof. John Park Based on slides from previous iterations of this course Today s Topics Overview Uses and motivations of hash tables Major concerns with hash

More information

Introduction hashing: a technique used for storing and retrieving information as quickly as possible.

Introduction hashing: a technique used for storing and retrieving information as quickly as possible. Lecture IX: Hashing Introduction hashing: a technique used for storing and retrieving information as quickly as possible. used to perform optimal searches and is useful in implementing symbol tables. Why

More information

Hash Tables Outline. Definition Hash functions Open hashing Closed hashing. Efficiency. collision resolution techniques. EECS 268 Programming II 1

Hash Tables Outline. Definition Hash functions Open hashing Closed hashing. Efficiency. collision resolution techniques. EECS 268 Programming II 1 Hash Tables Outline Definition Hash functions Open hashing Closed hashing collision resolution techniques Efficiency EECS 268 Programming II 1 Overview Implementation style for the Table ADT that is good

More information

CMSC 341 Hashing. Based on slides from previous iterations of this course

CMSC 341 Hashing. Based on slides from previous iterations of this course CMSC 341 Hashing Based on slides from previous iterations of this course Hashing Searching n Consider the problem of searching an array for a given value q If the array is not sorted, the search requires

More information

Hash Tables. Hash functions Open addressing. March 07, 2018 Cinda Heeren / Geoffrey Tien 1

Hash Tables. Hash functions Open addressing. March 07, 2018 Cinda Heeren / Geoffrey Tien 1 Hash Tables Hash functions Open addressing Cinda Heeren / Geoffrey Tien 1 Hash functions A hash function is a function that map key values to array indexes Hash functions are performed in two steps Map

More information

Algorithms and Data Structures

Algorithms and Data Structures Lesson 4: Sets, Dictionaries and Hash Tables Luciano Bononi http://www.cs.unibo.it/~bononi/ (slide credits: these slides are a revised version of slides created by Dr. Gabriele D Angelo)

More information

Understand how to deal with collisions

Understand how to deal with collisions Understand the basic structure of a hash table and its associated hash function Understand what makes a good (and a bad) hash function Understand how to deal with collisions Open addressing Separate chaining

More information

General Idea. Key could be an integer, a string, etc e.g. a name or Id that is a part of a large employee structure

General Idea. Key could be an integer, a string, etc e.g. a name or Id that is a part of a large employee structure Hashing 1 Hash Tables We ll discuss the hash table ADT which supports only a subset of the operations allowed by binary search trees. The implementation of hash tables is called hashing. Hashing is a technique

More information

Lecture 16 More on Hashing Collision Resolution

Lecture 16 More on Hashing Collision Resolution Lecture 16 More on Hashing Collision Resolution Introduction In this lesson we will discuss several collision resolution strategies. The key thing in hashing is to find an easy to compute hash function.

More information

Hashing. Hashing Procedures

Hashing. Hashing Procedures Hashing Hashing Procedures Let us denote the set of all possible key values (i.e., the universe of keys) used in a dictionary application by U. Suppose an application requires a dictionary in which elements

More information

HashTable CISC5835, Computer Algorithms CIS, Fordham Univ. Instructor: X. Zhang Fall 2018

HashTable CISC5835, Computer Algorithms CIS, Fordham Univ. Instructor: X. Zhang Fall 2018 HashTable CISC5835, Computer Algorithms CIS, Fordham Univ. Instructor: X. Zhang Fall 2018 Acknowledgement The set of slides have used materials from the following resources Slides for textbook by Dr. Y.

More information

Hash table basics. ate à. à à mod à 83

Hash table basics. ate à. à à mod à 83 Hash table basics After today, you should be able to explain how hash tables perform insertion in amortized O(1) time given enough space ate à hashcode() à 48594983à mod à 83 82 83 ate 84 } EditorTrees

More information

Hash Table and Hashing

Hash Table and Hashing Hash Table and Hashing The tree structures discussed so far assume that we can only work with the input keys by comparing them. No other operation is considered. In practice, it is often true that an input

More information

Lecture 18. Collision Resolution

Lecture 18. Collision Resolution Lecture 18 Collision Resolution Introduction In this lesson we will discuss several collision resolution strategies. The key thing in hashing is to find an easy to compute hash function. However, collisions

More information

Tirgul 7. Hash Tables. In a hash table, we allocate an array of size m, which is much smaller than U (the set of keys).

Tirgul 7. Hash Tables. In a hash table, we allocate an array of size m, which is much smaller than U (the set of keys). Tirgul 7 Find an efficient implementation of a dynamic collection of elements with unique keys Supported Operations: Insert, Search and Delete. The keys belong to a universal group of keys, U = {1... M}.

More information

CS/COE 1501

CS/COE 1501 CS/COE 1501 www.cs.pitt.edu/~lipschultz/cs1501/ Hashing Wouldn t it be wonderful if... Search through a collection could be accomplished in Θ(1) with relatively small memory needs? Lets try this: Assume

More information

Hashing. Dr. Ronaldo Menezes Hugo Serrano. Ronaldo Menezes, Florida Tech

Hashing. Dr. Ronaldo Menezes Hugo Serrano. Ronaldo Menezes, Florida Tech Hashing Dr. Ronaldo Menezes Hugo Serrano Agenda Motivation Prehash Hashing Hash Functions Collisions Separate Chaining Open Addressing Motivation Hash Table Its one of the most important data structures

More information

Hashing Techniques. Material based on slides by George Bebis

Hashing Techniques. Material based on slides by George Bebis Hashing Techniques Material based on slides by George Bebis https://www.cse.unr.edu/~bebis/cs477/lect/hashing.ppt The Search Problem Find items with keys matching a given search key Given an array A, containing

More information

! A Hash Table is used to implement a set, ! The table uses a function that maps an. ! The function is called a hash function.

! A Hash Table is used to implement a set, ! The table uses a function that maps an. ! The function is called a hash function. Hash Tables Chapter 20 CS 3358 Summer II 2013 Jill Seaman Sections 201, 202, 203, 204 (not 2042), 205 1 What are hash tables?! A Hash Table is used to implement a set, providing basic operations in constant

More information

Acknowledgement HashTable CISC4080, Computer Algorithms CIS, Fordham Univ.

Acknowledgement HashTable CISC4080, Computer Algorithms CIS, Fordham Univ. Acknowledgement HashTable CISC4080, Computer Algorithms CIS, Fordham Univ. Instructor: X. Zhang Spring 2018 The set of slides have used materials from the following resources Slides for textbook by Dr.

More information

Hash Tables. Hashing Probing Separate Chaining Hash Function

Hash Tables. Hashing Probing Separate Chaining Hash Function Hash Tables Hashing Probing Separate Chaining Hash Function Introduction In Chapter 4 we saw: linear search O( n ) binary search O( log n ) Can we improve the search operation to achieve better than O(

More information

Hash table basics mod 83 ate. ate. hashcode()

Hash table basics mod 83 ate. ate. hashcode() Hash table basics ate hashcode() 82 83 84 48594983 mod 83 ate Reminder from syllabus: EditorTrees worth 10% of term grade See schedule page Exam 2 moved to Friday after break. Short pop quiz over AVL rotations

More information

Hash table basics mod 83 ate. ate

Hash table basics mod 83 ate. ate Hash table basics After today, you should be able to explain how hash tables perform insertion in amortized O(1) time given enough space ate hashcode() 82 83 84 48594983 mod 83 ate 1. Section 2: 15+ min

More information

CSI33 Data Structures

CSI33 Data Structures Outline Department of Mathematics and Computer Science Bronx Community College November 30, 2016 Outline Outline 1 Chapter 13: Heaps, Balances Trees and Hash Tables Hash Tables Outline 1 Chapter 13: Heaps,

More information

Algorithms with numbers (2) CISC4080, Computer Algorithms CIS, Fordham Univ.! Instructor: X. Zhang Spring 2017

Algorithms with numbers (2) CISC4080, Computer Algorithms CIS, Fordham Univ.! Instructor: X. Zhang Spring 2017 Algorithms with numbers (2) CISC4080, Computer Algorithms CIS, Fordham Univ.! Instructor: X. Zhang Spring 2017 Acknowledgement The set of slides have used materials from the following resources Slides

More information

Algorithms with numbers (2) CISC4080, Computer Algorithms CIS, Fordham Univ. Acknowledgement. Support for Dictionary

Algorithms with numbers (2) CISC4080, Computer Algorithms CIS, Fordham Univ. Acknowledgement. Support for Dictionary Algorithms with numbers (2) CISC4080, Computer Algorithms CIS, Fordham Univ. Instructor: X. Zhang Spring 2017 Acknowledgement The set of slides have used materials from the following resources Slides for

More information

COSC160: Data Structures Hashing Structures. Jeremy Bolton, PhD Assistant Teaching Professor

COSC160: Data Structures Hashing Structures. Jeremy Bolton, PhD Assistant Teaching Professor COSC160: Data Structures Hashing Structures Jeremy Bolton, PhD Assistant Teaching Professor Outline I. Hashing Structures I. Motivation and Review II. Hash Functions III. HashTables I. Implementations

More information

Question Bank Subject: Advanced Data Structures Class: SE Computer

Question Bank Subject: Advanced Data Structures Class: SE Computer Question Bank Subject: Advanced Data Structures Class: SE Computer Question1: Write a non recursive pseudo code for post order traversal of binary tree Answer: Pseudo Code: 1. Push root into Stack_One.

More information

Adapted By Manik Hosen

Adapted By Manik Hosen Adapted By Manik Hosen Basic Terminology Question: Define Hashing. Ans: Concept of building a data structure that can be searched in O(l) time is called Hashing. Question: Define Hash Table with example.

More information

Introduction to Hashing

Introduction to Hashing Lecture 11 Hashing Introduction to Hashing We have learned that the run-time of the most efficient search in a sorted list can be performed in order O(lg 2 n) and that the most efficient sort by key comparison

More information

Data and File Structures Chapter 11. Hashing

Data and File Structures Chapter 11. Hashing Data and File Structures Chapter 11 Hashing 1 Motivation Sequential Searching can be done in O(N) access time, meaning that the number of seeks grows in proportion to the size of the file. B-Trees improve

More information

Comp 335 File Structures. Hashing

Comp 335 File Structures. Hashing Comp 335 File Structures Hashing What is Hashing? A process used with record files that will try to achieve O(1) (i.e. constant) access to a record s location in the file. An algorithm, called a hash function

More information

Hash table basics mod 83 ate. ate

Hash table basics mod 83 ate. ate Hash table basics After today, you should be able to explain how hash tables perform insertion in amortized O(1) time given enough space ate hashcode() 82 83 84 48594983 mod 83 ate Topics: weeks 1-6 Reading,

More information

Dynamic Dictionaries. Operations: create insert find remove max/ min write out in sorted order. Only defined for object classes that are Comparable

Dynamic Dictionaries. Operations: create insert find remove max/ min write out in sorted order. Only defined for object classes that are Comparable Hashing Dynamic Dictionaries Operations: create insert find remove max/ min write out in sorted order Only defined for object classes that are Comparable Hash tables Operations: create insert find remove

More information

Hash Tables. Gunnar Gotshalks. Maps 1

Hash Tables. Gunnar Gotshalks. Maps 1 Hash Tables Maps 1 Definition A hash table has the following components» An array called a table of size N» A mathematical function called a hash function that maps keys to valid array indices hash_function:

More information

Dictionary. Dictionary. stores key-value pairs. Find(k) Insert(k, v) Delete(k) List O(n) O(1) O(n) Sorted Array O(log n) O(n) O(n)

Dictionary. Dictionary. stores key-value pairs. Find(k) Insert(k, v) Delete(k) List O(n) O(1) O(n) Sorted Array O(log n) O(n) O(n) Hash-Tables Introduction Dictionary Dictionary stores key-value pairs Find(k) Insert(k, v) Delete(k) List O(n) O(1) O(n) Sorted Array O(log n) O(n) O(n) Balanced BST O(log n) O(log n) O(log n) Dictionary

More information

HASH TABLES. Goal is to store elements k,v at index i = h k

HASH TABLES. Goal is to store elements k,v at index i = h k CH 9.2 : HASH TABLES 1 ACKNOWLEDGEMENT: THESE SLIDES ARE ADAPTED FROM SLIDES PROVIDED WITH DATA STRUCTURES AND ALGORITHMS IN C++, GOODRICH, TAMASSIA AND MOUNT (WILEY 2004) AND SLIDES FROM JORY DENNY AND

More information

CSE 326: Data Structures Lecture #11 B-Trees

CSE 326: Data Structures Lecture #11 B-Trees CSE 326: Data Structures Lecture #11 B-Trees Alon Halevy Spring Quarter 2001 B-Tree Properties Properties maximum branching factor of M the root has between 2 and M children other internal nodes have between!m/2"

More information

Outline. Computer Science 331. Desirable Properties of Hash Functions. What is a Hash Function? Hash Functions. Mike Jacobson.

Outline. Computer Science 331. Desirable Properties of Hash Functions. What is a Hash Function? Hash Functions. Mike Jacobson. Outline Computer Science 331 Mike Jacobson Department of Computer Science University of Calgary Lecture #20 1 Definition Desirable Property: Easily Computed 2 3 Universal Hashing 4 References Mike Jacobson

More information

CS 310 Hash Tables, Page 1. Hash Tables. CS 310 Hash Tables, Page 2

CS 310 Hash Tables, Page 1. Hash Tables. CS 310 Hash Tables, Page 2 CS 310 Hash Tables, Page 1 Hash Tables key value key value Hashing Function CS 310 Hash Tables, Page 2 The hash-table data structure achieves (near) constant time searching by wasting memory space. the

More information

Hashing for searching

Hashing for searching Hashing for searching Consider searching a database of records on a given key. There are three standard techniques: Searching sequentially start at the first record and look at each record in turn until

More information

Symbol Table. Symbol table is used widely in many applications. dictionary is a kind of symbol table data dictionary is database management

Symbol Table. Symbol table is used widely in many applications. dictionary is a kind of symbol table data dictionary is database management Hashing Symbol Table Symbol table is used widely in many applications. dictionary is a kind of symbol table data dictionary is database management In general, the following operations are performed on

More information

CSE 214 Computer Science II Searching

CSE 214 Computer Science II Searching CSE 214 Computer Science II Searching Fall 2017 Stony Brook University Instructor: Shebuti Rayana shebuti.rayana@stonybrook.edu http://www3.cs.stonybrook.edu/~cse214/sec02/ Introduction Searching in a

More information

HASH TABLES. Hash Tables Page 1

HASH TABLES. Hash Tables Page 1 HASH TABLES TABLE OF CONTENTS 1. Introduction to Hashing 2. Java Implementation of Linear Probing 3. Maurer s Quadratic Probing 4. Double Hashing 5. Separate Chaining 6. Hash Functions 7. Alphanumeric

More information

Hashing 1. Searching Lists

Hashing 1. Searching Lists Hashing 1 Searching Lists There are many instances when one is interested in storing and searching a list: A phone company wants to provide caller ID: Given a phone number a name is returned. Somebody

More information

Hashing. 1. Introduction. 2. Direct-address tables. CmSc 250 Introduction to Algorithms

Hashing. 1. Introduction. 2. Direct-address tables. CmSc 250 Introduction to Algorithms Hashing CmSc 250 Introduction to Algorithms 1. Introduction Hashing is a method of storing elements in a table in a way that reduces the time for search. Elements are assumed to be records with several

More information

Lecture 7: Efficient Collections via Hashing

Lecture 7: Efficient Collections via Hashing Lecture 7: Efficient Collections via Hashing These slides include material originally prepared by Dr. Ron Cytron, Dr. Jeremy Buhler, and Dr. Steve Cole. 1 Announcements Lab 6 due Friday Lab 7 out tomorrow

More information

Tables. The Table ADT is used when information needs to be stored and acessed via a key usually, but not always, a string. For example: Dictionaries

Tables. The Table ADT is used when information needs to be stored and acessed via a key usually, but not always, a string. For example: Dictionaries 1: Tables Tables The Table ADT is used when information needs to be stored and acessed via a key usually, but not always, a string. For example: Dictionaries Symbol Tables Associative Arrays (eg in awk,

More information

CSCI 104 Hash Tables & Functions. Mark Redekopp David Kempe

CSCI 104 Hash Tables & Functions. Mark Redekopp David Kempe CSCI 104 Hash Tables & Functions Mark Redekopp David Kempe Dictionaries/Maps An array maps integers to values Given i, array[i] returns the value in O(1) Dictionaries map keys to values Given key, k, map[k]

More information

BBM371& Data*Management. Lecture 6: Hash Tables

BBM371& Data*Management. Lecture 6: Hash Tables BBM371& Data*Management Lecture 6: Hash Tables 8.11.2018 Purpose of using hashes A generalization of ordinary arrays: Direct access to an array index is O(1), can we generalize direct access to any key

More information

Hash Tables and Hash Functions

Hash Tables and Hash Functions Hash Tables and Hash Functions We have seen that with a balanced binary tree we can guarantee worst-case time for insert, search and delete operations. Our challenge now is to try to improve on that...

More information

Cpt S 223. School of EECS, WSU

Cpt S 223. School of EECS, WSU Hashing & Hash Tables 1 Overview Hash Table Data Structure : Purpose To support insertion, deletion and search in average-case constant t time Assumption: Order of elements irrelevant ==> data structure

More information

HASH TABLES cs2420 Introduction to Algorithms and Data Structures Spring 2015

HASH TABLES cs2420 Introduction to Algorithms and Data Structures Spring 2015 HASH TABLES cs2420 Introduction to Algorithms and Data Structures Spring 2015 1 administrivia 2 -assignment 9 is due on Monday -assignment 10 will go out on Thursday -midterm on Thursday 3 last time 4

More information

More on Hashing: Collisions. See Chapter 20 of the text.

More on Hashing: Collisions. See Chapter 20 of the text. More on Hashing: Collisions See Chapter 20 of the text. Collisions Let's do an example -- add some people to a hash table of size 7. Name h = hash(name) h%7 Ben 66667 6 Bob 66965 3 Steven -1808493797-5

More information

Introduction. hashing performs basic operations, such as insertion, better than other ADTs we ve seen so far

Introduction. hashing performs basic operations, such as insertion, better than other ADTs we ve seen so far Chapter 5 Hashing 2 Introduction hashing performs basic operations, such as insertion, deletion, and finds in average time better than other ADTs we ve seen so far 3 Hashing a hash table is merely an hashing

More information

HASH TABLES.

HASH TABLES. 1 HASH TABLES http://en.wikipedia.org/wiki/hash_table 2 Hash Table A hash table (or hash map) is a data structure that maps keys (identifiers) into a certain location (bucket) A hash function changes the

More information

Hashing HASHING HOW? Ordered Operations. Typical Hash Function. Why not discard other data structures?

Hashing HASHING HOW? Ordered Operations. Typical Hash Function. Why not discard other data structures? HASHING By, Durgesh B Garikipati Ishrath Munir Hashing Sorting was putting things in nice neat order Hashing is the opposite Put things in a random order Algorithmically determine position of any given

More information

Introducing Hashing. Chapter 21. Copyright 2012 by Pearson Education, Inc. All rights reserved

Introducing Hashing. Chapter 21. Copyright 2012 by Pearson Education, Inc. All rights reserved Introducing Hashing Chapter 21 Contents What Is Hashing? Hash Functions Computing Hash Codes Compressing a Hash Code into an Index for the Hash Table A demo of hashing (after) ARRAY insert hash index =

More information

Fast Lookup: Hash tables

Fast Lookup: Hash tables CSE 100: HASHING Operations: Find (key based look up) Insert Delete Fast Lookup: Hash tables Consider the 2-sum problem: Given an unsorted array of N integers, find all pairs of elements that sum to a

More information

Lecture 16. Reading: Weiss Ch. 5 CSE 100, UCSD: LEC 16. Page 1 of 40

Lecture 16. Reading: Weiss Ch. 5 CSE 100, UCSD: LEC 16. Page 1 of 40 Lecture 16 Hashing Hash table and hash function design Hash functions for integers and strings Collision resolution strategies: linear probing, double hashing, random hashing, separate chaining Hash table

More information

CS 241 Analysis of Algorithms

CS 241 Analysis of Algorithms CS 241 Analysis of Algorithms Professor Eric Aaron Lecture T Th 9:00am Lecture Meeting Location: OLB 205 Business HW5 extended, due November 19 HW6 to be out Nov. 14, due November 26 Make-up lecture: Wed,

More information

Topic HashTable and Table ADT

Topic HashTable and Table ADT Topic HashTable and Table ADT Hashing, Hash Function & Hashtable Search, Insertion & Deletion of elements based on Keys So far, By comparing keys! Linear data structures Non-linear data structures Time

More information

CS 310 Advanced Data Structures and Algorithms

CS 310 Advanced Data Structures and Algorithms CS 310 Advanced Data Structures and Algorithms Hashing June 6, 2017 Tong Wang UMass Boston CS 310 June 6, 2017 1 / 28 Hashing Hashing is probably one of the greatest programming ideas ever. It solves one

More information

Hashing. CptS 223 Advanced Data Structures. Larry Holder School of Electrical Engineering and Computer Science Washington State University

Hashing. CptS 223 Advanced Data Structures. Larry Holder School of Electrical Engineering and Computer Science Washington State University Hashing CptS 223 Advanced Data Structures Larry Holder School of Electrical Engineering and Computer Science Washington State University 1 Overview Hashing Technique supporting insertion, deletion and

More information

Hash[ string key ] ==> integer value

Hash[ string key ] ==> integer value Hashing 1 Overview Hash[ string key ] ==> integer value Hash Table Data Structure : Use-case To support insertion, deletion and search in average-case constant time Assumption: Order of elements irrelevant

More information

Fundamental Algorithms

Fundamental Algorithms Fundamental Algorithms Chapter 7: Hash Tables Michael Bader Winter 2011/12 Chapter 7: Hash Tables, Winter 2011/12 1 Generalised Search Problem Definition (Search Problem) Input: a sequence or set A of

More information

Dictionaries and Hash Tables

Dictionaries and Hash Tables Dictionaries and Hash Tables 0 1 2 3 025-612-0001 981-101-0002 4 451-229-0004 Dictionaries and Hash Tables 1 Dictionary ADT The dictionary ADT models a searchable collection of keyelement items The main

More information

Chapter 20 Hash Tables

Chapter 20 Hash Tables Chapter 20 Hash Tables Dictionary All elements have a unique key. Operations: o Insert element with a specified key. o Search for element by key. o Delete element by key. Random vs. sequential access.

More information

CSE373: Data Structures & Algorithms Lecture 17: Hash Collisions. Kevin Quinn Fall 2015

CSE373: Data Structures & Algorithms Lecture 17: Hash Collisions. Kevin Quinn Fall 2015 CSE373: Data Structures & Algorithms Lecture 17: Hash Collisions Kevin Quinn Fall 2015 Hash Tables: Review Aim for constant-time (i.e., O(1)) find, insert, and delete On average under some reasonable assumptions

More information

Hash Open Indexing. Data Structures and Algorithms CSE 373 SP 18 - KASEY CHAMPION 1

Hash Open Indexing. Data Structures and Algorithms CSE 373 SP 18 - KASEY CHAMPION 1 Hash Open Indexing Data Structures and Algorithms CSE 373 SP 18 - KASEY CHAMPION 1 Warm Up Consider a StringDictionary using separate chaining with an internal capacity of 10. Assume our buckets are implemented

More information

Hash Tables: Handling Collisions

Hash Tables: Handling Collisions CSE 373: Data Structures and Algorithms Hash Tables: Handling Collisions Autumn 208 Shrirang (Shri) Mare shri@cs.washington.edu Thanks to Kasey Champion, Ben Jones, Adam Blank, Michael Lee, Evan McCarty,

More information

9/24/ Hash functions

9/24/ Hash functions 11.3 Hash functions A good hash function satis es (approximately) the assumption of SUH: each key is equally likely to hash to any of the slots, independently of the other keys We typically have no way

More information

Computer Science Foundation Exam

Computer Science Foundation Exam Computer Science Foundation Exam December 13, 2013 Section I A COMPUTER SCIENCE NO books, notes, or calculators may be used, and you must work entirely on your own. SOLUTION Question # Max Pts Category

More information

CPSC 211, Sections : Data Structures and Implementations, Honors Final Exam May 4, 2001

CPSC 211, Sections : Data Structures and Implementations, Honors Final Exam May 4, 2001 CPSC 211, Sections 201 203: Data Structures and Implementations, Honors Final Exam May 4, 2001 Name: Section: Instructions: 1. This is a closed book exam. Do not use any notes or books. Do not confer with

More information

Data Structures. Topic #6

Data Structures. Topic #6 Data Structures Topic #6 Today s Agenda Table Abstract Data Types Work by value rather than position May be implemented using a variety of data structures such as arrays (statically, dynamically allocated)

More information

CSE 332: Data Structures & Parallelism Lecture 10:Hashing. Ruth Anderson Autumn 2018

CSE 332: Data Structures & Parallelism Lecture 10:Hashing. Ruth Anderson Autumn 2018 CSE 332: Data Structures & Parallelism Lecture 10:Hashing Ruth Anderson Autumn 2018 Today Dictionaries Hashing 10/19/2018 2 Motivating Hash Tables For dictionary with n key/value pairs insert find delete

More information

Data Structures & File Management

Data Structures & File Management The Cost of Searching 1 Given a collection of N equally-likely data values, any search algorithm that proceeds by comparing data values to each other must, on average, perform at least Θ(log N) comparisons

More information

Data Structures And Algorithms

Data Structures And Algorithms Data Structures And Algorithms Hashing Eng. Anis Nazer First Semester 2017-2018 Searching Search: find if a key exists in a given set Searching algorithms: linear (sequential) search binary search Search

More information

Introduction To Hashing

Introduction To Hashing Introduction To Hashing In this section of notes you will learn an approach for organizing information that allows for searches in constant time Searching For Information Algorithms You Know Linear search

More information

CSE 2320 Notes 13: Hashing

CSE 2320 Notes 13: Hashing CSE 30 Notes 3: Hashing (Last updated 0/7/7 : PM) CLRS.-. (skip.3.3) 3.A. CONCEPTS Goal: Achieve faster operations than balanced trees (nearly Ο( ) epected time) by using randomness in key sets by sacrificing

More information

CSC 321: Data Structures. Fall 2016

CSC 321: Data Structures. Fall 2016 CSC : Data Structures Fall 6 Hash tables HashSet & HashMap hash table, hash function collisions Ø linear probing, lazy deletion, primary clustering Ø quadratic probing, rehashing Ø chaining HashSet & HashMap

More information

Hashing. October 19, CMPE 250 Hashing October 19, / 25

Hashing. October 19, CMPE 250 Hashing October 19, / 25 Hashing October 19, 2016 CMPE 250 Hashing October 19, 2016 1 / 25 Dictionary ADT Data structure with just three basic operations: finditem (i): find item with key (identifier) i insert (i): insert i into

More information

Announcements. Reading Material. Recap. Today 9/17/17. Storage (contd. from Lecture 6)

Announcements. Reading Material. Recap. Today 9/17/17. Storage (contd. from Lecture 6) CompSci 16 Intensive Computing Systems Lecture 7 Storage and Index Instructor: Sudeepa Roy Announcements HW1 deadline this week: Due on 09/21 (Thurs), 11: pm, no late days Project proposal deadline: Preliminary

More information

CSCE 2014 Final Exam Spring Version A

CSCE 2014 Final Exam Spring Version A CSCE 2014 Final Exam Spring 2017 Version A Student Name: Student UAID: Instructions: This is a two-hour exam. Students are allowed one 8.5 by 11 page of study notes. Calculators, cell phones and computers

More information

1. Attempt any three of the following: 15

1. Attempt any three of the following: 15 (Time: 2½ hours) Total Marks: 75 N. B.: (1) All questions are compulsory. (2) Make suitable assumptions wherever necessary and state the assumptions made. (3) Answers to the same question must be written

More information

Symbol Tables. ASU Textbook Chapter 7.6, 6.5 and 6.3. Tsan-sheng Hsu.

Symbol Tables. ASU Textbook Chapter 7.6, 6.5 and 6.3. Tsan-sheng Hsu. Symbol Tables ASU Textbook Chapter 7.6, 6.5 and 6.3 Tsan-sheng Hsu tshsu@iis.sinica.edu.tw http://www.iis.sinica.edu.tw/~tshsu 1 Definitions Symbol table: A data structure used by a compiler to keep track

More information

SFU CMPT Lecture: Week 8

SFU CMPT Lecture: Week 8 SFU CMPT-307 2008-2 1 Lecture: Week 8 SFU CMPT-307 2008-2 Lecture: Week 8 Ján Maňuch E-mail: jmanuch@sfu.ca Lecture on June 24, 2008, 5.30pm-8.20pm SFU CMPT-307 2008-2 2 Lecture: Week 8 Universal hashing

More information

CSC 261/461 Database Systems Lecture 17. Fall 2017

CSC 261/461 Database Systems Lecture 17. Fall 2017 CSC 261/461 Database Systems Lecture 17 Fall 2017 Announcement Quiz 6 Due: Tonight at 11:59 pm Project 1 Milepost 3 Due: Nov 10 Project 2 Part 2 (Optional) Due: Nov 15 The IO Model & External Sorting Today

More information

STRUKTUR DATA. By : Sri Rezeki Candra Nursari 2 SKS

STRUKTUR DATA. By : Sri Rezeki Candra Nursari 2 SKS STRUKTUR DATA By : Sri Rezeki Candra Nursari 2 SKS Literatur Sjukani Moh., (2007), Struktur Data (Algoritma & Struktur Data 2) dengan C, C++, Mitra Wacana Media Utami Ema. dkk, (2007), Struktur Data (Konsep

More information

Hashing. Manolis Koubarakis. Data Structures and Programming Techniques

Hashing. Manolis Koubarakis. Data Structures and Programming Techniques Hashing Manolis Koubarakis 1 The Symbol Table ADT A symbol table T is an abstract storage that contains table entries that are either empty or are pairs of the form (K, I) where K is a key and I is some

More information

Successful vs. Unsuccessful

Successful vs. Unsuccessful Hashing Search Given: Distinct keys k 1, k 2,, k n and collection T of n records of the form (k 1, I 1 ), (k 2, I 2 ),, (k n, I n ) where I j is the information associated with key k j for 1

More information

Algorithms and Data Structures

Algorithms and Data Structures Algorithms and Data Structures Open Hashing Ulf Leser Open Hashing Open Hashing: Store all values inside hash table A General framework No collision: Business as usual Collision: Chose another index and

More information