401 data structures and algorithms code challenges
Implement a simplified LEFT JOIN for 2 Hashmaps. Write a function that LEFT JOINs two hashmaps into a single data structure.
NULL
should be appended to the result row.| Synonyms Hash Table | | | Antonyms Hash Table | |
|—|—|—|—|—|
| Key
| Value
| | Key
| Value
|
| diligent | employed | | diligent | idle |
| fond | enamored | | fond | averse |
| guide | usher | | guide | follow |
| flow | garb | | flow | jam |
| wrath | anger | | wrath | delight |
[
["font", "enamored", "averse"],
["wrath", "anger", "delight"],
["diligent", "employed", "idle"],
["outfit", "garb", NULL],
["guide", "usher","follow"]
]
Consider a RIGHT JOIN. Can you implement this as a new function? How about by passing an optional parameter to your initial function, to specify if LEFT JOIN or RIGHT JOIN logic should be used?