Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > [QUIZ] Longest Repeated Substring (#153)

Reply
Thread Tools

[QUIZ] Longest Repeated Substring (#153)

 
 
Radosław Bułat
Guest
Posts: n/a
 
      01-18-2008
PiBJdCBzaG91bGQsIG90aGVyd2lzZSAiYmFuYW5hIiB3b3VsZC BnaXZlICJhbmEiIHJhdGhlciB0
aGFuICJhbiIuCgpPciBldmVuIGJldHRlciBpdCB3b3VsZCBiZS B0aGUgc2FtZSBzdHJpbmcuCgot
LSAKUmFkb3OzYXcgQnWzYXQKCmh0dHA6Ly9yYWRhcmVrLmpvZ2 dlci5wbCAtIG3zaiBibG9nCg==

 
Reply With Quote
 
 
 
 
James Gray
Guest
Posts: n/a
 
      01-18-2008
On Jan 18, 2008, at 3:10 PM, Rados=B3aw Bu=B3at wrote:

> On Jan 18, 2008 10:00 PM, yermej <(E-Mail Removed)> wrote:
>> On Jan 18, 2:38 pm, Ken Bloom <(E-Mail Removed)> wrote:

>
>> And a second:
>> "aaaaaa" should give "aaa"
>>
>> Right?

>
> It should, otherwise "banana" would give "ana" rather than "an".
>
> My question is (I'm not familiar with RubyQuiz too much ): episode
> focus on algorithm (speed) or source code (readable)?


Hopefully both.

James Edward Gray II=

 
Reply With Quote
 
 
 
 
Robert Dober
Guest
Posts: n/a
 
      01-18-2008
MjAwOC8xLzE4IFJhZG9zs2F3IEJ1s2F0IDxyYWRlay5idWxhdE BnbWFpbC5jb20+Ogo+IE9uIEph
biAxOCwgMjAwOCAxMDowMCBQTSwgeWVybWVqIDx5ZXJtZWpAZ2 1haWwuY29tPiB3cm90ZToKPiA+
IE9uIEphbiAxOCwgMjozOCBwbSwgS2VuIEJsb29tIDxrYmwuLi 5AZ21haWwuY29tPiB3cm90ZToK
Pgo+ID4gQW5kIGEgc2Vjb25kOgo+ID4gImFhYWFhYSIgc2hvdW xkIGdpdmUgImFhYSIKPiA+Cj4g
PiBSaWdodD8KPgo+IEl0IHNob3Vs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JvdGguIC A6KQoKSG93IGxvbmcgaW5wdXQg
c3RyaW5nIEkgY291bGQgZXhwZWN0PwoKLS0gClJhZG9zs2F3IE J1s2F0CgpodHRwOi8vcmFkYXJl
ay5qb2dnZXIucGwgLSBt82ogYmxvZwo=

 
Reply With Quote
 
tho_mica_l
Guest
Posts: n/a
 
      01-18-2008
> First testcase:
> "your banana my banana" should give " banana"


For the GNU GENERAL PUBLIC LICENSE Version 2, June 1991, I get:

"customarily used for software interchange; or, "... some more
whitespace

For the GPL3 I get:

") Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by "...

If somebody can verify this.

I think this really starts to make fun when running the script over
Mark Twains entire work (from Gutenberg) or something similar.
 
Reply With Quote
 
yermej
Guest
Posts: n/a
 
      01-18-2008
On Jan 18, 3:54 pm, tho_mica_l <(E-Mail Removed)> wrote:
> > First testcase:
> > "your banana my banana" should give " banana"

>
> For the GNU GENERAL PUBLIC LICENSE Version 2, June 1991, I get:
>
> "customarily used for software interchange; or, "... some more
> whitespace
>
> For the GPL3 I get:
>
> ") Convey the object code in, or embodied in, a physical product
> (including a physical distribution medium), accompanied by "...
>
> If somebody can verify this.
>
> I think this really starts to make fun when running the script over
> Mark Twains entire work (from Gutenberg) or something similar.


I agree on GPL3.

How much whitespace followed your GPL2 result? I ended up with
" 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\n"
which is 57 characters. Maybe just a difference in the text files we
used? I used 'ruby-1.8.6/GPL'.
 
Reply With Quote
 
tho_mica_l
Guest
Posts: n/a
 
      01-18-2008
> " 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\n"

It seems there is another version of this document around (at least on
my harddisk) in which the line in the header reads " 59 Temple Place,
Suite 330, Boston, MA 02111 USA\n" instead.

Thanks for verifying.

Thomas.
 
Reply With Quote
 
ara.t.howard
Guest
Posts: n/a
 
      01-18-2008

On Jan 18, 2008, at 2:00 PM, yermej wrote:

> On Jan 18, 2:38 pm, Ken Bloom <(E-Mail Removed)> wrote:
>> First testcase:
>> "your banana my banana" should give " banana"
>>
>> --Ken
>>
>> --
>> Ken (Chanoch) Bloom. PhD candidate. Linguistic Cognition Laboratory.
>> Department of Computer Science. Illinois Institute of
>> Technology.http://www.iit.edu/~kbloom1/

>
> And a second:
> "aaaaaa" should give "aaa"
>
> Right?


i would think that

'aaaaaa'.longest_repeating_substring #=> 'aaaaa'

the quiz did not say that the two strings could not overlap.

is this correct james?

a @ http://codeforpeople.com/
--
share your knowledge. it's a way to achieve immortality.
h.h. the 14th dalai lama



 
Reply With Quote
 
James Gray
Guest
Posts: n/a
 
      01-18-2008
On Jan 18, 2008, at 3:42 PM, Rados=B3aw Bu=B3at wrote:

>>> My question is (I'm not familiar with RubyQuiz too much ): episode
>>> focus on algorithm (speed) or source code (readable)?

>>
>> Hopefully both.

>
> How long input string I could expect?


Anybody found a good long text to work with yet? The text of the U.S. =20=

Constitution perhaps? Tristram Shandy?

I would say that you should handle the biggest text you possibly =20
can.

James Edward Gray II=

 
Reply With Quote
 
Denis Hennessy
Guest
Posts: n/a
 
      01-19-2008
On 18 Jan 2008, at 23:05, ara.t.howard wrote:

>> And a second:
>> "aaaaaa" should give "aaa"
>>
>> Right?

>
> i would think that
>
> 'aaaaaa'.longest_repeating_substring #=> 'aaaaa'
>
> the quiz did not say that the two strings could not overlap.
>
> is this correct james?


Actually the spec says "Repeated substrings may not overlap." so the
correct answer for "aaaaaa" should be "aaa".

/dh

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
My Custom Longest Common Substring which searches for a pattern failson certain strings Alec Taylor C++ 1 11-14-2011 06:07 PM
Custom Longest Common Substring which includes a number fails whenword appears before number Alec Taylor C++ 1 11-14-2011 06:07 PM
[SUMMARY] Longest Repeated Substring (#153) Ruby Quiz Ruby 0 01-24-2008 04:11 PM
longest common substring Henry Townsend Perl Misc 4 11-02-2006 02:24 PM
Longest Sites Name With Worlds Longest Stuffs... Vijay Murthy Computer Information 0 02-04-2006 09:57 AM



Advertisments