I have a number of string arrays. The string in every array are ordered the same way, according the same criteria. However, some string may be missing from some arrays, and there may be no array that has a complete set of strings. Moreover, the criteria used to compare the strings is not available to me: outside of the context of the array, I cannot tell which string should precede another.
I need a way to produce a complete set of strings, properly ordered. Or fail when the arrays do not have enough information for me to do so.
Is anyone familiar with this kind of problem? What is the proper algorithm?
Examples:
A B D A C D
Can’t order correctly, can’t decide the order of B and C
A B D A B C A C D
This has enough information to order ABCD correctly.
This sounds like a special case of the topological sorting problem.