If you need alphabetical order, use Trie or DAWG (as I recommended in your last question). For the order, in addition to the alphabet, I would use a binary tree (std :: map in C ++ is implemented with a red-black tree usually).
Implementing an order-saving hash container sounds like the mother of all early optimizations.
source
share