Use a directed graph with 26 vertices; each vertex represents a symbol. The edge from vertex A to vertex B means in the alphabet B before A.
The first step is to establish such a graph only with vertices, but without edges.
Secondly, you scan the input dictionary, word for word. And compare each word with the previous word. You need to find the exact relationship for every word you crawled. This way you add an edge to this graph. Suppose the dictionary is correct, there should be no conflict.
After you have finished the dictionary, you display the alphabet in
- select a random vertex, go through its path until you find one symbol that indicates nothing. This is the first character in the alphabet. Bring it out and remove it from the chart.
- 1 , .
EDIT:
, .
: { "", "", "", "" }
0 1, , z a, a- > z
1 2, , , c- > a
Word 2 Word 3, "c", -, , a r, r- > a
. , (, c), c- > a- > z . z z ( NULL). (, r), r- > a . a a . (, c), , c . , r, , r . , .
: z, a, c, r. "c" "r" , .