Lecture 6 : Dynamic Hashing Bong-Soo Sohn Assistant Professor School of Computer Science and Engineering Chung-Ang University.

Slides:



Advertisements
Similar presentations
Hash Tables CS 310 – Professor Roch Weiss Chapter 20 All figures marked with a chapter and section number are copyrighted © 2006 by Pearson Addison-Wesley.
Advertisements

Extendible Hashing - Class Example
External Memory Hashing. Model of Computation Data stored on disk(s) Minimum transfer unit: a page = b bytes or B records (or block) N records -> N/B.
The Dictionary ADT Definition A dictionary is an ordered or unordered list of key-element pairs, where keys are used to locate elements in the list. Example:
Hashing Dashiell Fryer CS 157B Dr. Lee. Contents Static Hashing Static Hashing File OrganizationFile Organization Properties of the Hash FunctionProperties.
1 Hash-Based Indexes Module 4, Lecture 3. 2 Introduction As for any index, 3 alternatives for data entries k* : – Data record with key value k – –Choice.
CPSC 335 Dr. Marina Gavrilova Computer Science University of Calgary Canada.
Quick Review of Apr 10 material B+-Tree File Organization –similar to B+-tree index –leaf nodes store records, not pointers to records stored in an original.
Department of Computer Science and Engineering, HKUST Slide 1 Dynamic Hashing Good for database that grows and shrinks in size Allows the hash function.
File Processing : Hash 2015, Spring Pusan National University Ki-Joune Li.
©Silberschatz, Korth and Sudarshan12.1Database System Concepts Chapter 12: Indexing and Hashing Basic Concepts Ordered Indices B+-Tree Index Files B-Tree.
Hashing as a Dictionary Implementation
CST203-2 Database Management Systems Lecture 7. Disadvantages on index structure: We must access an index structure to locate data, or must use binary.
Hash Table indexing and Secondary Storage Hashing.
B+-tree and Hashing.
Liang, Introduction to Java Programming, Eighth Edition, (c) 2011 Pearson Education, Inc. All rights reserved Chapter 48 Hashing.
1 Hash-Based Indexes Chapter Introduction  Hash-based indexes are best for equality selections. Cannot support range searches.  Static and dynamic.
Chapter 5: Hashing Hash Tables
CPSC-608 Database Systems Fall 2011 Instructor: Jianer Chen Office: HRBB 315C Phone: Notes #11.
1 Hash-Based Indexes Chapter Introduction : Hash-based Indexes  Best for equality selections.  Cannot support range searches.  Static and dynamic.
HASH TABLES Malathi Mansanpally CS_257 ID-220. Agenda: Extensible Hash Tables Insertion Into Extensible Hash Tables Linear Hash Tables Insertion Into.
1 Lecture 19: B-trees and Hash Tables Wednesday, November 12, 2003.
CS 4432lecture #10 - indexing & hashing1 CS4432: Database Systems II Lecture #10 Professor Elke A. Rundensteiner.
Data Structures Using C++ 2E Chapter 9 Searching and Hashing Algorithms.
Introducing Hashing Chapter 21 Copyright ©2012 by Pearson Education, Inc. All rights reserved.
CPSC-608 Database Systems Fall 2011 Instructor: Jianer Chen Office: HRBB 315C Phone: Notes #12.
Basic File Structures and Hashing Lectured by, Jesmin Akhter, Assistant professor, IIT, JU.
Chapter 11 Indexing & Hashing. 2 n Sophisticated database access methods n Basic concerns: access/insertion/deletion time, space overhead n Indexing 
Hashing Chapter 20. Hash Table A hash table is a data structure that allows fast find, insert, and delete operations (most of the time). The simplest.
TECH Computer Science Dynamic Sets and Searching Analysis Technique  Amortized Analysis // average cost of each operation in the worst case Dynamic Sets.
Comp 335 File Structures Hashing.
Lecture 12 : Trie Data Structure Bong-Soo Sohn Assistant Professor School of Computer Science and Engineering Chung-Ang University.
Hashing and Hash-Based Index. Selection Queries Yes! Hashing  static hashing  dynamic hashing B+-tree is perfect, but.... to answer a selection query.
1 5. Abstract Data Structures & Algorithms 5.2 Static Data Structures.
Hashing - 2 Designing Hash Tables Sections 5.3, 5.4, 5.4, 5.6.
Hashing 8 April Example Consider a situation where we want to make a list of records for students currently doing the BSU CS degree, with each.
1 CPS216: Advanced Database Systems Notes 05: Operators for Data Access (contd.) Shivnath Babu.
1 Lecture 21: Hash Tables Wednesday, November 17, 2004.
Chapter 9 Hashing Dr. Youssef Harrath
Data Structure & Algorithm Lecture 8 – Hashing JJCAO Most materials are stolen from Prof. Yoram Moses’s course.
Hashing by Rafael Jaffarove CS157b. Motivation  Fast data access  Search  Insertion  Deletion  Ideal seek time is O(1)
Database System Concepts, 6 th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com Module D: Hashing.
Hash Tables ADT Data Dictionary, with two operations – Insert an item, – Search for (and retrieve) an item How should we implement a data dictionary? –
1 Data Structures CSCI 132, Spring 2014 Lecture 33 Hash Tables.
April 2002Information Systems Design John Ogden & John Wordsworth FOI: 1 Database Design File organisations and indexes John Wordsworth Department of Computer.
Chapter 5 Record Storage and Primary File Organizations
TOPIC 5 ASSIGNMENT SORTING, HASH TABLES & LINKED LISTS Yerusha Nuh & Ivan Yu.
Em Spatiotemporal Database Laboratory Pusan National University File Processing : Hash 2004, Spring Pusan National University Ki-Joune Li.
Data Structures Chapter 8: Hashing 8-1. Performance Comparison of Arrays and Trees Is it possible to perform these operations in O(1) ? ArrayTree Sorted.
CS422 Principles of Database Systems Indexes Chengyu Sun California State University, Los Angeles.
CS422 Principles of Database Systems Indexes
Chapter 27 Hashing Jung Soo (Sue) Lim Cal State LA.
School of Computer Science and Engineering
Lecture 21: Hash Tables Monday, February 28, 2005.
EEE2108: Programming for Engineers Chapter 8. Hashing
Database Management Systems (CS 564)
Dynamic Hashing.
Advanced Associative Structures
Chapter 28 Hashing.
Extendible Indexing Dina Said
Chapter 21 Hashing: Implementing Dictionaries and Sets
External Memory Hashing
Indexing and Hashing Basic Concepts Ordered Indices
Hash Tables Chapter 12 discusses several ways of storing information in an array, and later searching for the information. Hash tables are a common.
Indexing and Hashing B.Ramamurthy Chapter 11 2/5/2019 B.Ramamurthy.
Advanced Implementation of Tables
2018, Spring Pusan National University Ki-Joune Li
Hash Tables Chapter 12 discusses several ways of storing information in an array, and later searching for the information. Hash tables are a common.
Hash-Based Indexes Chapter 11
Presentation transcript:

Lecture 6 : Dynamic Hashing Bong-Soo Sohn Assistant Professor School of Computer Science and Engineering Chung-Ang University

2 Dynamic Hashing A hash table that grows to handle more items Virtual Hashing Dynamic Hashing Extendible Hashing Linear Hashing

Virtual Hashing Use more than one hashing functions Hash function : use modular function H0 : address = key % N (N=2^0 X N) # of buckets : N Size of bucket : C When overflow occurs Related bucket is split Different hash function is used. C+1 records are rehashed Hj : address = key % (2^j X N ), j=0, 1, 2, …

Virtual Hashing Example N = 100, C = 4 bucket 3 is full : [3, 103, 203, 303] H0 = key % 100 Overflow! when new record 403 is inserted Use h1 = key % 200 and split bucket Bucket 3 Bucket 103

Virtual Hashing Overflow when 603, 803 are inserted Use h2 = key % 400 to split buckets What happens? When a key is searched, what hash function to apply? Problems How to handle the space between two split buckets?

Dynamic hashing # of buckets : N Bucket size : C We have indices pointing to each bucket Example N=20, C=3

Dynamic Hashing Use two functions Hashing function H0 obtain index entry # Each index entry is corresponding to binary tree root Determine which binary tree Bit function B convert key to Bit String (bit string size is controlled) Decide which branch within each index binary tree

Dynamic hashing algorithm Convert key into index using H0 Store a record in a bucket pointed by the index If the bucket is full, split the bucket and make a binary tree and assign the record into appropriate binary tree node(bucket)

Dynamic hashing H0(key) determine binary tree root node B(key) determine branch direction

Dynamic hashing : example B(key) 0 : left, 1 : right

Insert records 157, 95, 88, 205, 13

Insert record 125 additionally

Insert records 301, 6

Design Project (due : Nov 12, 11:59pm) Description Design and implement your own dynamic hashing algorithm where hash table size can grow dynamically. Submit 1 : Report Your algorithm description including figures Performance (compare with other trivial method such as re-hashing) Show tables and graphs(plots) as much as possible. Strength & weakness of your algorithm Your report should be concise and easy to understand though it should contain essential information on your method and implementation Submit 2 : source code source code that includes your algorithm When executing your code, the program should print detailed description on the events that occur in hash table for each operation.