File tree 1 file changed +6
-7
lines changed
Filter options
modules/HashTable/DoubleHashing 1 file changed +6
-7
lines changed
Original file line number Diff line number Diff line change @@ -183,14 +183,13 @@ static uint find_bucket(HashTable ht, Pointer value)
183
183
uint count = 0 ;
184
184
const uint h1 = ht -> hash (value ), interval = hash_func2 (PRIME_NUM , h1 );
185
185
186
- for (uint pos = h1 %ht -> capacity ; ht -> buckets [pos ].state != EMPTY ; pos = (pos + interval ) % ht -> capacity )
186
+ for (uint pos = h1 %ht -> capacity ; ht -> buckets [pos ].state != EMPTY ; pos = (pos + interval ) % ht -> capacity )
187
187
{
188
- if (ht -> buckets [pos ].state == OCCUPIED && ht -> compare (ht -> buckets [pos ].data , value ) == 0 )
189
- return pos ;
190
-
191
- if (++ count == ht -> capacity ) // searched all buckets containing data, value does not exist
192
- return ht -> capacity ;
193
- }
188
+ if (ht -> buckets [pos ].state == OCCUPIED && ht -> compare (ht -> buckets [pos ].data , value ) == 0 )
189
+ return pos ;
190
+ if (++ count == ht -> capacity ) // searched all buckets containing data, value does not exist
191
+ return ht -> capacity ;
192
+ }
194
193
195
194
// reached an empty bucket, value does not exist
196
195
return ht -> capacity ;
You can’t perform that action at this time.
0 commit comments