问题:
[单选题]How to measure the efficiency of a given algorithm for string matching? 给定一个进行串匹配的算法,如何衡量它的效率?
ABy generating large amount of random inputs and measure the run time empirically
随机生成大量的文本串T和模式串P作为输入,通过实验的方法进行测量
BBy assuming uniform probability distribution for text strings and patterns, and calculating the expectation accordingly
认为所有不同文本串T和模式串P出现的概率是相等的,依此计算时间复杂度的期望
CBy analyzing the different cases when the match succeeds and fails
对于成功匹配和失败匹配两种情况分别讨论其时间复杂度
DBy calculating the expectation assuming a fixed text string and random patterns
选取固定的文本串T,随机选取模式串P,计算时间复杂度的期望