Download presentation
Presentation is loading. Please wait.
Published byFarida Halim Modified over 6 years ago
1
COMPUTER 2430 Object Oriented Programming and Data Structures I
2
Handling Collision Linear Probe (Open Addressing):
Go to the next available slot (circular) Double Hashing: Use a second hashing function if collision occurs (circular) Buckets Each array slot points to an array (2-D array) Quiz is coming? Program due! 2 2 2
3
Double Hashing First Hashing Function h1: index = h1(key) = key % table_size Second Hashing Function h2 for collision: step = h2(key) = 1 + key % AnotherPrime Quiz is coming? Program due! 3 3 3 3
4
Twin Primes 11 and and and 1231 Donald Knuth Table size : the larger one AnotherPrime: the smaller one Quiz is coming? Program due! 4 4 4 4
5
Example/Exercise Index = h1(key) = key % 13
Step = h2(key) = 1 + key % 11 Key : Index: ? ? ? ? ? ? ? ? ? Step : ? ? ? ? ? ? ? ? ? 21
6
Example/Exercise Index = h1(key) = key % 13
Step = h2(key) = 1 + key % 11 Key : Index: ? ? ? ? ? ? ? ? ? Step : ? ? ? ? ? ? ? ? ? 21 60 21
7
Example/Exercise Index = h1(key) = key % 13
Step = h2(key) = 1 + key % 11 Key : Index: ? ? ? ? ? ? ? ? ? Step : ? ? ? ? ? ? ? ? ? 60 21 60 86 21
8
Example/Exercise Index = h1(key) = key % 13
Step = h2(key) = 1 + key % 11 Key : Index: ? ? ? ? ? ? ? ? ? Step : ? ? ? ? ? ? ? ? ? 60 86 21 60 86 21 23
9
Example/Exercise Index = h1(key) = key % 13
Step = h2(key) = 1 + key % 11 Key : Index: ? ? ? ? ? ? ? ? ? Step : ? ? ? ? ? ? ? ? ? 60 86 21 23 60 86 75 21 23
10
Example/Exercise Index = h1(key) = key % 13
Step = h2(key) = 1 + key % 11 Key : Index: ? ? ? ? ? ? ? ? ? Step : ? ? ? ? ? ? ? ? ? 60 86 75 21 23 62 60 86 75 21 23
11
Example/Exercise Index = h1(key) = key % 13
Step = h2(key) = 1 + key % 11 Key : Index: ? ? ? ? ? ? ? ? ? Step : ? ? ? ? ? ? ? ? ? 62 60 86 75 21 23 62 60 86 32 75 21 23
12
Example/Exercise Index = h1(key) = key % 13
Step = h2(key) = 1 + key % 11 Key : Index: ? ? ? ? ? ? ? ? ? Step : ? ? ? ? ? ? ? ? ? 62 60 86 32 75 21 23 62 60 86 32 75 21 23 45
13
Example/Exercise Index = h1(key) = key % 13
Step = h2(key) = 1 + key % 11 Key : Index: ? ? ? ? ? ? ? ? ? Step : ? ? ? ? ? ? ? ? ? 62 60 86 32 75 21 23 45 62 60 86 32 75 21 58 23 45
14
Quiz 6 Wednesday, December 5 Binary Search Hashing Counting
15
Prog 6 Group sign up Plan in SE Tool By 11:50 am
Three students a group if possible Plan in SE Tool By 11 pm Monday Group discussion to agree Each student enters his/her plan
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.