in reply to Re^2: An efficient way to gather a common portion of several strings' beginnings
in thread An efficient way to gather a common portion of several strings' beginnings

> Update 2. Sometimes one is the most oblivious to the most obvious. Added the third version lcp_v6.

I could call using modules cheating, but

a) it's core

b) you have to admit that hippo's sort approach is sexy!

--- with le/ge abcdefghijklmnopqrstuvwxyz0.000100071512918021 abcdefghijklmnopqrstuvwxyz9.83499014282074e-05 0.786839962005615 --- with minstr/maxstr abcdefghijklmnopqrstuvwxyz0.000100071512918021 abcdefghijklmnopqrstuvwxyz9.83499014282074e-05 0.23346209526062

Though your final comparison fails with some edge cases :-P

Cheers Rolf
(addicted to the Perl Programming Language and ☆☆☆☆ :)
Je suis Charlie!

  • Comment on Re^3: An efficient way to gather a common portion of several strings' beginnings
  • Download Code