Since the algorithms can run on different haystacks (texts) and needles (patterns), it is not fair to directly compare their run-time/comparison-count averages. Moreover, since the complexity of both of these algorithms involve two variables, n (text length) and m (pattern length), we need to study how the performance varies depending on the sizes of both n and m. Therefore, my program measures and outputs the following 4 ratios:
- Ratio between length of run-time and n.
- Ratio between length of run-time and m.
- Ratio between # of comparisons and n.
- Ratio between # of comparisons and m.
This is in an attempt to make a fair and accurate comparison between both algorithms. After each search, the averages for these 4 ratios are updated.