While in fact the order of markers in each clue can be important to the clue's ultimate use, during the sorting phase, the order could be revised to say the order of the ascii vector a. . If each clue were first sorted, then all clues sorted in this pseudo alphabetic form, if the indices of the clues were noted at first, they could be used to retrieve the original clues.
That all makes me think of lexicographic sort order and maybe about http://en.wikipedia.org/wiki/Lexicographic_breadth-first_search . The wikipedia page is pretty brief, and I wonder if it could be applied to this problem. The pseudo code is given as follows. "Initialize a sequence Σ of sets, to contain a single set containing all vertices. Initialize the output sequence of vertices to be empty. While Σ is non-empty: Find and remove a vertex v from the first set in Σ If the first set in Σ is now empty, remove it from Σ Add v to the end of the output sequence. For each edge vw such that w still belongs to a set S in Σ: If the set S containing w has not yet been replaced while processing v, create a new empty replacement set T and place it prior to S in the sequence; otherwise, let T be the set prior to S. Move w from S to T, and if this causes S to become empty remove S from the sequence." I have at least two questions. Does it seem that this algorithm applies to this sorting problem? If so, then I think the key part that I don't understand is in the fifth step of the algorithm "For each edge vw ... " because I am unclear about how to construct the graph, much less the graph edges. Help, please. ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
