This question evaluates competency in tabular data manipulation and join semantics using Python dictionaries, emphasizing understanding of hashing-based lookups and algorithmic complexity such as O(N+M).
Orders
+---------+----------+--------+ | order_id| customer | amount | +---------+----------+--------+ | 101 | C1 | 250 | | 102 | C2 | 300 | | 103 | C3 | 150 |
Customers
+----------+-----------+ | customer | city | +----------+-----------+ | C1 | Seattle | | C3 | Boston | | C4 | Austin |
Performing a left join in pure Python without external libraries.
Write Python code (no third-party packages) to left-join two lists of dictionaries on key "customer"; discuss an O(N+M) hashing solution.
Contrast nested loops with dict-based look-ups; handle missing matches gracefully.