If there are two sets -
set1 - [tag, boLD, Link]
set2 - [BOLd, TAG, Badge, foo]
What could be the efficient algorithm for making pairs of elements like -
pairs = [tag, TAG], [boLD, BOLd], [Link, null], [null, Badge], [null, foo]
Notice the pairing is on the basis of case-insensitive
names.
I want to avoid O(N^2), that looks up all elements in set1 iteratively, and look in the element in set2.
EDIT: I think if we can use Ternary Search Tries
, to make symbol table implementation, where keys are elements from set1, and values from set2. set2 remaining elements could be dealt at last.