'Code to do inner join of two tables in less than O(m*n) runtime:
Do inner join of two tables in less than O(m*n) runtime:
Table1:
A | B
1 | 3
2 | 6
Table2:
B | C
6 | 8
5 | 3
Then table1.inner_join(table2, “B”) should return a table as follows since B = 6 in both tables:
A | B | C
2 | 6 | 8
Input:
columnNameForTable1: [A, B] rowsListForTable1: [[1, 2], [3, 6]]
columnNameForTable2: [B, C] rowsListForTable2: [[6, 5], [8, 3]]
Output should be:
columnNameForTable: [A, B, C] rowsListForTable2: [[2], [6] ,[8]]
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
