is there a way to Join 2 tables in linear time? I heard this can be done by having another data structure (Hashtable), but I’m not sure how this can be done. I was always wondering a Join will involve a cross-product and hence it is O(n^2).
Share
Algorithm:
Loop through table A. Hash all Items, Add them to the Join array.
Loop through table B, check each item if it’s in the hash table (Check – O(1)), if not, add to the Join table.