Initial Commit - Sonnet 4.5
This commit is contained in:
15
src/interfaces/IHashFunction.ts
Normal file
15
src/interfaces/IHashFunction.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
/**
|
||||
* Interface for hash functions.
|
||||
* Follows Interface Segregation Principle (ISP) and Dependency Inversion Principle (DIP).
|
||||
* Allows different hashing strategies to be implemented and injected.
|
||||
*/
|
||||
export interface IHashFunction<K> {
|
||||
/**
|
||||
* Computes a hash value for the given key.
|
||||
* @param key - The key to hash
|
||||
* @param capacity - The current capacity of the hash table
|
||||
* @returns A hash value in the range [0, capacity)
|
||||
*/
|
||||
hash(key: K, capacity: number): number;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user