Fastest String Search Algorithm.
Amit Choudhary
amitchoudhary0523@gmail.com
Fri Jun 11 19:41:26 GMT 2021
On Sat, Jun 12, 2021, 12:56 AM Paul Eggert <eggert@cs.ucla.edu> wrote:
> On 6/11/21 12:14 PM, Amit Choudhary via Libc-alpha wrote:
> > If there are two algorithms and algorithm1 performs better than
> algorithm2
> > in average case. But in worst case scenario, algorithm2 is better than
> > algorithm1.
>
> For glibc, worst-case is a big deal when it's measurable via the big-O
> notation. This is because of denial-of-service attacks and such-like. So
> in many cases we'll prefer an algorithm with a better worst-case behavior.
>
> Also, it's often easier to measure worst-case (because what is "average"
> is more debatable than what is worst), so focusing on worst-case helps
> cut down the more-difficult and lengthy discussion that would be needed
> to define "average", and this focus can save everybody time.
>
So, in this case, my algorithm is of no use because it better than strstr()
in average cases but not in worst cases.
Average case means real world scenarios. Worst case means hand crafted
worst case inputs.
So, from my side, this discussion is now over.
Regards,
Amit
More information about the Libc-alpha
mailing list