Remove technical documentation and testing files; add ESLint configuration and CI scripts for build and deployment processes.
This commit is contained in:
@@ -31,7 +31,7 @@ export class HashMap<K, V> implements IHashMap<K, V>, Iterable<[K, V]> {
|
||||
constructor(
|
||||
initialCapacity: number = 16,
|
||||
loadFactorThreshold: number = 0.75,
|
||||
hashFunction?: IHashFunction<K>
|
||||
hashFunction?: IHashFunction<K>,
|
||||
) {
|
||||
if (initialCapacity <= 0) {
|
||||
throw new Error("Initial capacity must be positive");
|
||||
@@ -276,4 +276,3 @@ export class HashMap<K, V> implements IHashMap<K, V>, Iterable<[K, V]> {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -85,4 +85,3 @@ console.log(` Load factor: ${map.loadFactor.toFixed(2)}`);
|
||||
console.log("");
|
||||
|
||||
console.log("=== Examples Complete ===");
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ console.log("1. Using NumericHashFunction:");
|
||||
const numericMap = new HashMap<number, string>(
|
||||
16,
|
||||
0.75,
|
||||
new NumericHashFunction()
|
||||
new NumericHashFunction(),
|
||||
);
|
||||
|
||||
numericMap.set(12345, "value1");
|
||||
@@ -45,7 +45,7 @@ class CaseInsensitiveHashFunction implements IHashFunction<string> {
|
||||
const caseInsensitiveMap = new HashMap<string, number>(
|
||||
16,
|
||||
0.75,
|
||||
new CaseInsensitiveHashFunction()
|
||||
new CaseInsensitiveHashFunction(),
|
||||
);
|
||||
|
||||
caseInsensitiveMap.set("Hello", 1);
|
||||
@@ -96,7 +96,11 @@ class ModuloHashFunction implements IHashFunction<number> {
|
||||
}
|
||||
}
|
||||
|
||||
const moduloMap = new HashMap<number, string>(8, 0.75, new ModuloHashFunction());
|
||||
const moduloMap = new HashMap<number, string>(
|
||||
8,
|
||||
0.75,
|
||||
new ModuloHashFunction(),
|
||||
);
|
||||
|
||||
for (let i = 0; i < 20; i++) {
|
||||
moduloMap.set(i, `value-${i}`);
|
||||
@@ -108,4 +112,3 @@ console.log(` Get 15: ${moduloMap.get(15)}`);
|
||||
console.log("");
|
||||
|
||||
console.log("=== Custom Hash Function Examples Complete ===");
|
||||
|
||||
|
||||
@@ -40,4 +40,3 @@ export class DefaultHashFunction<K> implements IHashFunction<K> {
|
||||
return String(key);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -22,4 +22,3 @@ export class NumericHashFunction implements IHashFunction<number> {
|
||||
return Math.floor(capacity * fractionalPart);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -12,4 +12,3 @@ export interface IHashFunction<K> {
|
||||
*/
|
||||
hash(key: K, capacity: number): number;
|
||||
}
|
||||
|
||||
|
||||
@@ -63,4 +63,3 @@ export interface IHashMap<K, V> {
|
||||
*/
|
||||
forEach(callback: (value: V, key: K, map: IHashMap<K, V>) => void): void;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@ export class HashNode<K, V> {
|
||||
constructor(
|
||||
public key: K,
|
||||
public value: V,
|
||||
public next: HashNode<K, V> | null = null
|
||||
public next: HashNode<K, V> | null = null,
|
||||
) {}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user