質問

Can someone please help me understanding which one is more efficient strstr() or KMP as recently I was doing a question on SPOJ and found that strstr() was in one way or other faster than KMP.. someone please explain the mystery behind this..

役に立ちましたか?

解決

You are comparing apples with pears, strstr() is a function to find substrings, KMP is an algorithm to do it, so strstr() could theoretically be implemented using KMP. You need to find out which algorithm is the strstr() in question implementing to give a statement.

Take a look at this answer and the comments on it.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top