字符串查找算法 时间和空间解决思路

字符串查找算法 时间和空间
最近遇到一个问题,说是从时间和空间优化的角度,分别写个查找算法,想不出啊,大家帮忙指导啊,

------解决方案--------------------
晚上給你,現在寫的話沒時間
------解决方案--------------------
从时间和空间优化的角度,分别写个查找算法
=====================
应该就是仅考虑一种因素的意思吧?

就是利用空间换取时间效率,
或者利用时间换取空间效率......
------解决方案--------------------
boost的string算法库find算法的文档中的原话:
Currently the library contains only naive implementation of find algorithms with complexity O(n * m) where n is the size of the input sequence and m is the size of the search sequence. There are algorithms with complexity O(n), but for smaller sequence a constant overhead is rather big. For small m < < n (m by magnitude smaller than n) the current implementation provides acceptable efficiency. Even the C++ standard defines the required complexity for search algorithm as O(n * m). It is possible that a future version of library will also contain algorithms with linear complexity as an option
------解决方案--------------------
这样好了。
你先看看到底有哪些查找算法,可以实现字符串查找。

然后再分析哪个最快。哪个使用的变量最少,内存最小。