Order preserving minimal perfect hash functions

2019-07-04 15:03发布

I want to implement an OPMPH function for the words in a dictionary in C++. How do I do it?

Thanks!

标签: c++ hash
3条回答
Root(大扎)
2楼-- · 2019-07-04 15:16

If you need alphabetical order use a Trie or a DAWG (like I recommended in your last question). For an order besides alphabetic I would use a binary tree (std::map in C++ is implemented with a red-black tree usually).

Implementing an order preserving hash container sounds like the mother of all early optimizations.

查看更多
SAY GOODBYE
3楼-- · 2019-07-04 15:22

Limit your word length to 6 letters or less and you might be able to make it work. Not very practical.

查看更多
登录 后发表回答