data-structures-and-algorithms

401 data structures and algorithms code challenges


Project maintained by alsosteve Hosted on GitHub Pages — Theme by mattgraham

Data Structures and Algorithms

Language: Python

Hashtable Left Join

Feature Tasks

Implement a simplified LEFT JOIN for 2 Hashmaps. Write a function that LEFT JOINs two hashmaps into a single data structure.

Method:

NOTES:

Whiteboard Process

challenge33

Examples

Input

| 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 |

Output

[
   ["font", "enamored", "averse"],
   ["wrath", "anger", "delight"],
   ["diligent", "employed", "idle"],
   ["outfit", "garb", NULL],
   ["guide", "usher","follow"]
]

Stretch Goal

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?

Approach & Efficiency