DataStructures-and-Algorithms

Code Challenge

Implement a simplified LEFT JOIN for 2 Hashmaps.

Specifications

Challenge Setup & Execution

Branch Name: hashmap-left-join

Challenge Type: Code Challenge / Algorithm

Feature Tasks

Write a function that LEFT JOINs two hashmaps into a single data structure.

NOTES:

Structure and Testing

Utilize the Single-responsibility principle: any methods you write should be clean, reusable, abstract component parts to the whole challenge. You will be given feedback and marked down if you attempt to define a large, complex algorithm in one function definition.

Write at least three test assertions for each method that you define.

Ensure your tests are passing before you submit your solution.

Example

INPUT

Synonyms Hash Table     Antonyms Hash Table  
Key Value   Key Value
diligent employed   diligent idle
fond enamored   fond averse
guide usher   guide follow
outfit garb   flow jam
wrath anger   wrath delight
 

OUTPUT

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

Stretch Goals

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?

Documentation: Your README.md

# Hashmap LEFT JOIN
<!-- Short summary or background information -->

## Challenge
<!-- Description of the challenge -->

## Approach & Efficiency
<!-- What approach did you take? Why? What is the Big O space/time for this approach? -->

## Solution
<!-- Embedded whiteboard image -->

Submission Instructions

  1. Take a photo of your completed whiteboard, matching the example whiteboard layout
    1. Copy your photo into an /assets directory in your repo
    2. Give the image file the same name as the branch you are working on
    3. Embed the image in your README.md documentation
  2. Create a pull request from your branch to your main branch
  3. In your open pull request, leave as a comment a checklist of the specifications and tasks above, with the actual steps that you completed checked off
  4. Submitting your completed work:
    1. Copy the link to your open pull request and paste it into the corresponding assignment
    2. Leave a description of how long this assignment took you in the comments box
    3. Add any additional comments you like about your process or any difficulties you may have had with the assignment
  5. Merge your branch into main, and delete your branch (don’t worry, the PR link will still work)