[Purdue-pm] challenge problem for next meeting?

Michael Gribskov gribskov at purdue.edu
Wed Jul 29 10:14:41 PDT 2015


It significantly changes the challenge if  you want the output to 
inlclude only the (possibly) shortened forms that are unique to one 
person.  In this case, there is no way to refer to Cat Stevens.  the 
logic to identify that Cat must be maintained for Cat Stevens, and 
further reductions of Cath must be rejected seems to be complex.  Is 
this included in the challenge?

I have a pretty straightforward way to solve this more complicated 
problem, as well as a very simple ways to solve the problem as 
originally stated in minimum time.

On 7/29/2015 12:30 PM, Mark Senn wrote:
> Mark Senn <mark at purdue.edu> wrote on 2015-07-29 at 10:59 -04:
> |  Is there interest in this challenge problem for the next meeting?
> |  Write back if you'll talk, email, or blog about your solution.
> |  Given a list of names, for example
> |       Abe
> |       Alan
> |       Ben
> |       Cat
> |       Cathy
> |  print a list of all names, shortening them as much
> |  as possible, with them still remaining unique, like this
> |       Ab
> |       Abe
> |       Al
> |       Ala
> |       Alan
> |       B
> |       Be
> |       Ben
> |       Cat
> |       Cath
> |       Cathy
> |  in Perl 5 and Perl 6.
> |
> |  Read the names from a Perl data section one name per line.
> |  Do error checking to make sure you aren't given duplicate names.
> |  Perl 6 has grammars
> |       http://doc.perl6.org/language/grammars
> |  and sets, bags, and mixes:
> |       http://doc.perl6.org/language/setbagmix
>
> Michael Gribskov <gribskov at purdue.edu> wrote on 2015-07-29 at 11:56:39 -04:
> |  Do you want the output to be unique, e.g., both Cat and Cathy contain
> |  CAT, should it occur only once in output?
>
> Yes, just once.  After the program runs
>
>                 (This column is not part of the original problem
>                 definition,  I only added it to give an example of
>                 what I mean in the paragraph following this list.)
> THESE NAMES    COULD REFER TO THESE PEOPLE
> -----------    --------------------------------------------------
> Ab Abe         Abe Lincoln
> Al Ala Alan    Alan Turing
> B Be Ben       Ben Carson
> Cat            Cat Stevens
> Cath Cathy     Cathy Rigby
>
> Cath is not shortened to Cat because we'd get Cat Stevens
> and Cathy Rigby confused.
>
> -mark


-- 
Michael Gribskov
Hockmeyer Hall of Structural Biology
Department of Biological Sciences
Purdue University
240 S. Martin Jischke Drive
West Lafayette, IN 47907-1971

gribskov at purdue.edu     vox: 765.494.6933     fax: 765.496.1189
calendar: http://www.google.com/calendar/embed?src=mgribskov%40gmail.com





More information about the Purdue-pm mailing list