diff --git a/data_structures/map/hash_map.ts b/data_structures/map/hash_map.ts index 3a57d759..900848a5 100644 --- a/data_structures/map/hash_map.ts +++ b/data_structures/map/hash_map.ts @@ -15,7 +15,7 @@ import { Map } from "./map"; */ export class HashMap implements Map { private size!: number; - private buckets!: HashMapEntry[][]; + private buckets!: MapEntry[][]; private readonly loadFactor = 0.75; constructor() { @@ -47,7 +47,7 @@ export class HashMap implements Map { const bucket = this.buckets[index]; if (bucket.length === 0) { - bucket.push(new HashMapEntry(key, value)); + bucket.push(new MapEntry(key, value)); this.size++; return; } @@ -59,7 +59,7 @@ export class HashMap implements Map { } } - bucket.push(new HashMapEntry(key, value)); + bucket.push(new MapEntry(key, value)); this.size++; } @@ -164,8 +164,8 @@ export class HashMap implements Map { * * @returns The entries. */ - entries(): HashMapEntry[] { - const entries: HashMapEntry[] = []; + entries(): MapEntry[] { + const entries: MapEntry[] = []; for (const bucket of this.buckets) { for (const entry of bucket) { entries.push(entry); @@ -228,7 +228,7 @@ export class HashMap implements Map { * @param key The key. * @param value The value. */ -export class HashMapEntry { +export class MapEntry { key: K; value: V; diff --git a/data_structures/map/map.ts b/data_structures/map/map.ts index 1e15c893..ff2a9fc3 100644 --- a/data_structures/map/map.ts +++ b/data_structures/map/map.ts @@ -1,4 +1,4 @@ -import { HashMapEntry } from "./hash_map"; +import { MapEntry } from "./hash_map"; /** * This interface is a representation of the Map data structure. @@ -12,5 +12,5 @@ export interface Map { clear(): void; keys(): K[]; values(): V[]; - entries(): HashMapEntry[]; + entries(): MapEntry[]; }