@@ -2,23 +2,34 @@ const { HashTable } = PacktDataStructuresAlgorithms;
2
2
3
3
const hash = new HashTable ( ) ;
4
4
5
- hash . put ( 'Gandalf' , 'gandalf@email.com' ) ;
6
- hash . put ( 'John' , 'johnsnow@email.com' ) ;
7
- hash . put ( 'Tyrion' , 'tyrion@email.com' ) ;
8
- hash . put ( 'Aaron' , 'aaron@email.com' ) ;
9
- hash . put ( 'Donnie' , 'donnie@email.com' ) ;
10
- hash . put ( 'Ana' , 'ana@email.com' ) ;
5
+ console . log ( hash . hashCode ( 'Ygritte' ) + ' - Ygritte' ) ;
6
+ console . log ( hash . hashCode ( 'Jonathan' ) + ' - Jonathan' ) ;
7
+ console . log ( hash . hashCode ( 'Jamie' ) + ' - Jamie' ) ;
8
+ console . log ( hash . hashCode ( 'Jack' ) + ' - Jack' ) ;
9
+ console . log ( hash . hashCode ( 'Jasmine' ) + ' - Jasmine' ) ;
10
+ console . log ( hash . hashCode ( 'Jake' ) + ' - Jake' ) ;
11
+ console . log ( hash . hashCode ( 'Nathan' ) + ' - Nathan' ) ;
12
+ console . log ( hash . hashCode ( 'Athelstan' ) + ' - Athelstan' ) ;
13
+ console . log ( hash . hashCode ( 'Sue' ) + ' - Sue' ) ;
14
+ console . log ( hash . hashCode ( 'Aethelwulf' ) + ' - Aethelwulf' ) ;
15
+ console . log ( hash . hashCode ( 'Sargeras' ) + ' - Sargeras' ) ;
16
+
17
+ hash . put ( 'Ygritte' , 'ygritte@email.com' ) ;
11
18
hash . put ( 'Jonathan' , 'jonathan@email.com' ) ;
12
19
hash . put ( 'Jamie' , 'jamie@email.com' ) ;
13
- hash . put ( 'Sue ' , 'sue @email.com' ) ;
14
- hash . put ( 'Mindy ' , 'mindy @email.com' ) ;
15
- hash . put ( 'Paul ' , 'paul @email.com' ) ;
20
+ hash . put ( 'Jack ' , 'jack @email.com' ) ;
21
+ hash . put ( 'Jasmine ' , 'jasmine @email.com' ) ;
22
+ hash . put ( 'Jake ' , 'jake @email.com' ) ;
16
23
hash . put ( 'Nathan' , 'nathan@email.com' ) ;
24
+ hash . put ( 'Athelstan' , 'athelstan@email.com' ) ;
25
+ hash . put ( 'Sue' , 'sue@email.com' ) ;
26
+ hash . put ( 'Aethelwulf' , 'aethelwulf@email.com' ) ;
27
+ hash . put ( 'Sargeras' , 'sargeras@email.com' ) ;
17
28
18
29
console . log ( '**** Printing Hash **** ' ) ;
19
30
20
31
console . log ( hash . toString ( ) ) ;
21
- // {5 => [#Sue: sue @email.com] },{10 => [#Nathan: nathan @email .com]},{13 => [#Ana: ana @email .com]},{16 => [#Aaron: aaron @email .com]},{19 => [#Gandalf: gandalf @email .com]},{29 => [#John: johnsnow @email .com]},{32 => [#Paul: paul @email .com]}
32
+ // {4 => [#Ygritte: ygritte @email.com] },{5 => [#Aethelwulf: aethelwulf @email .com]},{7 => [#Athelstan: athelstan @email .com]},{8 => [#Jasmine: jasmine @email .com]},{9 => [#Jake: jake @email .com]},{10 => [#Sargeras: sargeras @email .com]}
22
33
23
34
console . log ( '**** Get **** ' ) ;
24
35
0 commit comments