我必须为具有以下功能的字典实现编写 C/C++ 代码:
单词基本上有定义(1个或多个)。
1) 插入
2)搜索(尽可能快)
3) 自动完成
4) 自动更正
5) 拼写检查
所以我需要知道怎么做?
哪种数据结构应该是最有效的?特里或哈斯特表或其他东西
使用哪种搜索技术...?
如何有效地实现自动完成和拼写检查..?
我必须为具有以下功能的字典实现编写 C/C++ 代码:
单词基本上有定义(1个或多个)。
1) 插入
2)搜索(尽可能快)
3) 自动完成
4) 自动更正
5) 拼写检查
所以我需要知道怎么做?
哪种数据结构应该是最有效的?特里或哈斯特表或其他东西
使用哪种搜索技术...?
如何有效地实现自动完成和拼写检查..?
Certainly you need a database with a list of words, then you need to split your text up into words and see if they exist in the database.
For Autocomplete you can just check that the text entered so far matches words in the dictionary (with a LIKE txt+'%' clause), implemented with an AJAX call.